public abstract class RequestResponse<T> extends Object
Constructor and Description |
---|
RequestResponse() |
Modifier and Type | Method and Description |
---|---|
RequestResponse |
addHeader(String key,
String value) |
String |
getHeaderString(String key) |
int |
getHttpCode() |
int |
getStatus() |
Map<String,String> |
getVitamHeaders() |
boolean |
isOk() |
static RequestResponse<com.fasterxml.jackson.databind.JsonNode> |
parseFromResponse(javax.ws.rs.core.Response response)
Parser the response for a RequestResponse object.
Might return an empty VitamError in case response is empty with only the HttpCode set and the Code set to empty String. |
static <T> RequestResponse<T> |
parseFromResponse(javax.ws.rs.core.Response response,
Class clazz)
Parser the response for a RequestResponse object.
Might return an empty VitamError in case response is empty with only the HttpCode set and the Code set to empty String. |
RequestResponse<T> |
parseHeadersFromResponse(javax.ws.rs.core.Response response) |
static RequestResponseOK |
parseRequestResponseOk(javax.ws.rs.core.Response response) |
static VitamError |
parseVitamError(javax.ws.rs.core.Response response) |
RequestResponse<T> |
setHttpCode(int httpCode) |
com.fasterxml.jackson.databind.JsonNode |
toJsonNode() |
abstract javax.ws.rs.core.Response |
toResponse()
transform a RequestResponse to a standard response
|
String |
toString() |
void |
unSetVitamHeaders() |
public int getHttpCode()
public RequestResponse<T> setHttpCode(int httpCode)
httpCode
- the httpCode to setpublic int getStatus()
public boolean isOk()
public RequestResponse addHeader(String key, String value)
public void unSetVitamHeaders()
public com.fasterxml.jackson.databind.JsonNode toJsonNode()
IllegalStateException
- if JsonNode parse exception occurredpublic RequestResponse<T> parseHeadersFromResponse(javax.ws.rs.core.Response response)
public static RequestResponse<com.fasterxml.jackson.databind.JsonNode> parseFromResponse(javax.ws.rs.core.Response response) throws IllegalStateException
response
- to parse in RequestResponseIllegalStateException
- if the response cannot be parsed to one of the two modelpublic static <T> RequestResponse<T> parseFromResponse(javax.ws.rs.core.Response response, Class clazz) throws IllegalStateException
response
- to parse in RequestResponseIllegalStateException
- if the response cannot be parsed to one of the two modelpublic static RequestResponseOK parseRequestResponseOk(javax.ws.rs.core.Response response) throws InvalidParseOperationException
response
- to parse in RequestResponseInvalidParseOperationException
- if JsonNode parse exception occurredpublic static VitamError parseVitamError(javax.ws.rs.core.Response response) throws InvalidParseOperationException
response
- to parse in RequestResponseInvalidParseOperationException
- if JsonNode parse exception occurredpublic abstract javax.ws.rs.core.Response toResponse()
Copyright © 2018 Vitam. All rights reserved.