public class GXInboundResponse extends Object
| Constructor and Description |
|---|
GXInboundResponse(HttpURLConnection connection) |
GXInboundResponse(javax.ws.rs.core.Response source)
Builds a new inbound response.
|
| Modifier and Type | Method and Description |
|---|---|
ErrorCode |
getErrorCode()
Gets the
ErrorCode inside the entity. |
<E extends Exception> |
getException()
Gets the
Exception inside the entity. |
Map<String,List<String>> |
getHeaderFields()
Returns an unmodifiable Map of the header fields.
|
int |
getHTTPCode()
Gets the status code from the HTTP response message.
|
String |
getMessage()
Gets the message in the response
|
byte[] |
getStreamedContent()
Returns the content of the response as byte array.
|
String |
getStreamedContentAsString()
Gets the streamed content as a string, if possible.
|
boolean |
hasBAD_REQUESTCode()
Checks if the response has a BAD_REQUEST (400) HTTP status.
|
boolean |
hasCREATEDCode()
Checks if the response has a CREATED (201) HTTP status.
|
boolean |
hasErrorCode()
Checks if there is an
ErrorCode in the entity. |
boolean |
hasException()
Checks if there is an
Exception in the entity. |
boolean |
hasGXError()
Checks if the response was generated as a
GXOutboundErrorResponse . |
boolean |
hasNOT_ACCEPTABLECode()
Checks if the response has a NOT_ACCEPTABLE (406) HTTP status.
|
boolean |
hasOKCode()
Checks if the response has a OK (200) HTTP status.
|
<T> T |
tryConvertStreamedContentFromJson(Class<T> raw)
Tries to convert the content from its Json serialization, if possible.
|
public GXInboundResponse(javax.ws.rs.core.Response source)
source - the original responsepublic GXInboundResponse(HttpURLConnection connection) throws IOException
connection - the connection from which to parse the informationIOExceptionpublic boolean hasException()
Exception in the entity.public boolean hasGXError()
GXOutboundErrorResponse .public <E extends Exception> E getException() throws ClassNotFoundException
Exception inside the entity.ClassNotFoundException - if the exception's class is not available on the classpathpublic boolean hasErrorCode()
ErrorCode in the entity.public ErrorCode getErrorCode()
ErrorCode inside the entity.public String getMessage()
public String getStreamedContentAsString()
public byte[] getStreamedContent()
public <T> T tryConvertStreamedContentFromJson(Class<T> raw) throws Exception
T - the type of the desired objectException - if the deserialization failspublic int getHTTPCode()
public boolean hasCREATEDCode()
public boolean hasOKCode()
public boolean hasNOT_ACCEPTABLECode()
public boolean hasBAD_REQUESTCode()
public Map<String,List<String>> getHeaderFields()
Copyright © 2018. All Rights Reserved.