public class JetAPIResponse extends APIResponse implements IJetAPIResponse
Modifier and Type | Class and Description |
---|---|
static class |
JetAPIResponse.ResponseCode
HTTP Response codes for the Jet API
|
Constructor and Description |
---|
JetAPIResponse(org.apache.http.ProtocolVersion pv,
org.apache.http.StatusLine status,
List<org.apache.http.Header> headers)
Create a new JetIAPIResponse instance
|
Modifier and Type | Method and Description |
---|---|
static javax.json.JsonObject |
checkErrors(IAPIResponse res)
Check for errors and return the json object from the response if any
|
static void |
checkErrors(javax.json.JsonObject res,
IAPIResponse apiRes)
Check the response body for errors
|
static JetAPIResponse |
createFromAPIResponse(IAPIResponse that)
Create a JetAPIResponse object from an IAPIResponse object
|
boolean |
isAccepted()
Is the response code 202
|
boolean |
isBadRequest()
Is the response code 400
|
boolean |
isCreated()
If the response code was 201
|
boolean |
isForbidden()
Is the response code 403
|
boolean |
isInternalServerError()
Is the response code 500
|
boolean |
isMethodNotAllowed()
Is the response code 405
|
boolean |
isNoContent()
Is the response code 203
|
boolean |
isNotFound()
Is the response code 404
|
boolean |
isOk()
If the response was successful
|
boolean |
isUnauthorized()
Is the response code 401
|
boolean |
isUnavailable()
Is the response code 503
|
copyFrom, getContentLength, getJsonObject, getProtocolVersion, getResponseCharsetName, getResponseContent, getStatusLine, headers, isFailure, isJson, isRequestFail, isServerFailure, isSuccess, setContent
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getContentLength, getJsonObject, getProtocolVersion, getResponseCharsetName, getResponseContent, getStatusLine, headers, isFailure, isJson, isRequestFail, isServerFailure, isSuccess, setContent
public JetAPIResponse(org.apache.http.ProtocolVersion pv, org.apache.http.StatusLine status, List<org.apache.http.Header> headers)
pv
- status
- headers
- public static JetAPIResponse createFromAPIResponse(IAPIResponse that) throws JetException
that
- Some responseJetException
- if the API returned an error responsepublic static final javax.json.JsonObject checkErrors(IAPIResponse res) throws JetException
res
- responseJetException
public static final void checkErrors(javax.json.JsonObject res, IAPIResponse apiRes) throws JetException
res
- JSON resultsJetException
- if there's an issuepublic boolean isOk()
isOk
in interface IJetAPIResponse
public boolean isCreated()
isCreated
in interface IJetAPIResponse
public boolean isAccepted()
isAccepted
in interface IJetAPIResponse
public boolean isNoContent()
isNoContent
in interface IJetAPIResponse
public boolean isBadRequest()
isBadRequest
in interface IJetAPIResponse
public boolean isUnauthorized()
isUnauthorized
in interface IJetAPIResponse
public boolean isForbidden()
isForbidden
in interface IJetAPIResponse
public boolean isNotFound()
isNotFound
in interface IJetAPIResponse
public boolean isMethodNotAllowed()
isMethodNotAllowed
in interface IJetAPIResponse
public boolean isInternalServerError()
isInternalServerError
in interface IJetAPIResponse
public boolean isUnavailable()
isUnavailable
in interface IJetAPIResponse
Copyright © 2017. All rights reserved.