public class RestApiResponseBuilder extends Object
| Modifier and Type | Field and Description |
|---|---|
protected List<javax.servlet.http.Cookie> |
additionalCookies |
protected Map<String,String> |
additionalHeaders |
protected String |
characterSet |
protected int |
httpStatus |
protected String |
mediaType |
protected Serializable |
response |
| Constructor and Description |
|---|
RestApiResponseBuilder() |
| Modifier and Type | Method and Description |
|---|---|
RestApiResponse |
build() |
RestApiResponseBuilder |
withAdditionalCookie(javax.servlet.http.Cookie cookie)
Adds a cookie to the HTTP response
|
RestApiResponseBuilder |
withAdditionalHeader(String name,
String value)
Adds a header in the HTTP response
|
RestApiResponseBuilder |
withCharacterSet(String characterSet)
Set the character set of the HTTP response.
|
RestApiResponseBuilder |
withContentRange(int pageIndex,
int pageSize)
When returning a paged result, sets the start index and the page size.
|
RestApiResponseBuilder |
withContentRange(int pageIndex,
int pageSize,
long totalSize)
When returning a paged result, sets the start index, the page size and the total size.
|
RestApiResponseBuilder |
withMediaType(String mediaType)
Set the media type of the HTTP response body.
|
RestApiResponseBuilder |
withResponse(Serializable response)
Set the body of the response
|
RestApiResponseBuilder |
withResponseStatus(int httpStatus)
Set the HTTP status of the response.
|
protected Serializable response
protected int httpStatus
protected final List<javax.servlet.http.Cookie> additionalCookies
protected String characterSet
protected String mediaType
public RestApiResponseBuilder withResponse(Serializable response)
response - the response bodypublic RestApiResponseBuilder withResponseStatus(int httpStatus)
httpStatus - the HTTP status of the responseHttpServletResponsepublic RestApiResponseBuilder withAdditionalHeader(String name, String value)
name - the name of the header to add in the response.value - the value for this headerHttpHeaderspublic RestApiResponseBuilder withAdditionalCookie(javax.servlet.http.Cookie cookie)
cookie - the Cookie to add to the responsepublic RestApiResponseBuilder withCharacterSet(String characterSet)
characterSet - the name of the character setCharsetpublic RestApiResponseBuilder withMediaType(String mediaType)
mediaType - the media type to set.public RestApiResponseBuilder withContentRange(int pageIndex, int pageSize)
pageIndex - the start index of the returned page.pageSize - the size of the returned page.RestApiResponseBuilderpublic RestApiResponseBuilder withContentRange(int pageIndex, int pageSize, long totalSize)
pageIndex - the start index of the returned page.pageSize - the size of the returned page.totalSize - the total size of the requested entity.RestApiResponseBuilderpublic RestApiResponse build()
Copyright © 2020 Bonitasoft S.A.. All rights reserved.