public class ReusableResponse<K> extends Object
Response
and simplifies dealing with the most common cases.Modifier and Type | Class and Description |
---|---|
static class |
ReusableResponse.Skipped<K>
A subclass of
ReusableResponse that represents requests that were skipped and never executed. |
Constructor and Description |
---|
ReusableResponse(javax.ws.rs.core.Response response,
Class<K> defaultBody) |
Modifier and Type | Method and Description |
---|---|
K |
getBody()
Retrieves the body of the
Response in its default representation. |
<T> T |
getBody(Class<T> aClass)
Returns the body of the
Response as a specified type. |
javax.ws.rs.core.Response |
getResponse()
Retrieves the raw response of the underlying
Response |
int |
getStatus()
Returns the HTTP status of the underlying
Response |
boolean |
ok()
Returns true if the status of the underlying
Response is a 2xx. |
boolean |
skipped()
Returns true if the request was skipped and never executed.
|
boolean |
success()
Returns true if the status of the underlying
Response is a 2xx. |
String |
toString() |
public K getBody()
Response
in its default representation.
Responses to RecordM request will tipically have a default representation of RecordmInstance
.
Other requests will probably have a Map as default representation.
public <T> T getBody(Class<T> aClass)
Response
as a specified type.aClass
- the alternative type that we want: String.class, Map.class, etc...public javax.ws.rs.core.Response getResponse()
Response
public int getStatus()
Response
public boolean ok()
Response
is a 2xx.public boolean skipped()
This should only occur on update requests called without changes.
public boolean success()
Response
is a 2xx.Copyright © 2021 Cult Of Bits, lda