public class BuiltGenericResponse<T> extends org.jboss.resteasy.specimpl.BuiltResponse implements GenericResponse<T>
BuiltResponse class with additional implementations for
GenericResponse.
Consumers should avoid depending on this class directly instead preferring to depend on the
GenericResponse or Response types. This class is necessary for the internal
workings of Resteasy because Resteasy is heavily dependent on the BuiltResponse class.
BuiltResponse,
GenericResponse| Modifier | Constructor and Description |
|---|---|
protected |
BuiltGenericResponse(T body,
ErrorBody errorBody,
javax.ws.rs.core.Response rawResponse) |
| Modifier and Type | Method and Description |
|---|---|
T |
body()
Get the response entity body,
null if no entity body is present. |
boolean |
bufferEntity() |
void |
close()
Closes the underlying response input stream.
|
static <T> BuiltGenericResponse<T> |
create(T body,
javax.ws.rs.core.Response rawResponse)
Creates a new instance of
BuiltGenericResponse with the specified body and underlying
rawResponse. |
ErrorBody |
errorBody()
Get the error body,
null if the response is not an error or no entity body is present. |
Set<String> |
getAllowedMethods()
Gets the allowed HTTP methods.
|
Map<String,javax.ws.rs.core.NewCookie> |
getCookies()
Gets any new cookies on the response.
|
Date |
getDate()
Gets the resposne date,
null if not present. |
Object |
getEntity() |
Class<?> |
getEntityClass() |
javax.ws.rs.core.EntityTag |
getEntityTag()
Gets the entity tag.
|
Type |
getGenericType() |
javax.ws.rs.core.MultivaluedMap<String,Object> |
getHeaders()
Gets a view of the response headers.
|
String |
getHeaderString(String name)
Gets a response header as a string value.
|
Locale |
getLanguage()
Gets the language of the response entity,
null if not specified. |
Date |
getLastModified()
Gets the last modified date,
null if not present. |
int |
getLength()
Gets the
Content-Length of the response if present, -1 otherwise. |
javax.ws.rs.core.Link |
getLink(String relation)
Gets the link for the relation,
null if not present. |
javax.ws.rs.core.Link.Builder |
getLinkBuilder(String relation)
Returns a link builder for the relation,
null if not present. |
Set<javax.ws.rs.core.Link> |
getLinks()
Gets the links from the response headers.
|
URI |
getLocation()
Gets the location,
null if not present. |
javax.ws.rs.core.MediaType |
getMediaType()
Gets the response entity media type, or
null of there is no response entity. |
javax.ws.rs.core.MultivaluedMap<String,Object> |
getMetadata() |
int |
getStatus()
Get the status of the response response.
|
javax.ws.rs.core.Response.StatusType |
getStatusInfo()
Get the status of the response response.
|
javax.ws.rs.core.MultivaluedMap<String,String> |
getStringHeaders()
Gets a view of the response headers.
|
boolean |
hasEntity() |
boolean |
hasLink(String relation)
Returns true if a link exists for the specified relation, false otherwise.
|
boolean |
isSuccessful()
Returns true if
GenericResponse.getStatus() is in the range [200..300), false otherwise. |
<U> U |
readEntity(Class<U> entityType) |
<U> U |
readEntity(Class<U> entityType,
Annotation[] annotations) |
<U> U |
readEntity(javax.ws.rs.core.GenericType<U> entityType) |
<U> U |
readEntity(javax.ws.rs.core.GenericType<U> entityType,
Annotation[] annotations) |
String |
toString() |
getEntityStream, getInputStream, readEntity, readFrom, releaseConnection, releaseConnection, setInputStreamabortIfClosed, addMethodAnnotations, getAnnotations, getHeaderValueProcessor, getReasonPhrase, isClosed, resetEntity, setAnnotations, setEntity, setEntityClass, setGenericType, setMetadata, setReasonPhrase, setStatus, setStreamFullyRead, setStreamRead, toHeaderStringpublic static <T> BuiltGenericResponse<T> create(T body, javax.ws.rs.core.Response rawResponse)
BuiltGenericResponse with the specified body and underlying
rawResponse.body - the response entity bodyrawResponse - the underlying raw responsepublic boolean isSuccessful()
GenericResponseGenericResponse.getStatus() is in the range [200..300), false otherwise.isSuccessful in interface GenericResponse<T>public T body()
GenericResponsenull if no entity body is present.body in interface GenericResponse<T>public ErrorBody errorBody()
GenericResponsenull if the response is not an error or no entity body is present.errorBody in interface GenericResponse<T>public Class<?> getEntityClass()
getEntityClass in class org.jboss.resteasy.specimpl.AbstractBuiltResponsepublic Type getGenericType()
getGenericType in class org.jboss.resteasy.specimpl.AbstractBuiltResponsepublic int getStatus()
GenericResponsegetStatus in interface GenericResponse<T>getStatus in class org.jboss.resteasy.specimpl.AbstractBuiltResponsepublic javax.ws.rs.core.Response.StatusType getStatusInfo()
GenericResponsegetStatusInfo in interface GenericResponse<T>getStatusInfo in class org.jboss.resteasy.specimpl.AbstractBuiltResponsepublic Object getEntity()
getEntity in class org.jboss.resteasy.specimpl.AbstractBuiltResponsepublic <U> U readEntity(Class<U> entityType)
readEntity in class org.jboss.resteasy.specimpl.AbstractBuiltResponsepublic <U> U readEntity(javax.ws.rs.core.GenericType<U> entityType)
readEntity in class org.jboss.resteasy.specimpl.AbstractBuiltResponsepublic <U> U readEntity(Class<U> entityType, Annotation[] annotations)
readEntity in class org.jboss.resteasy.specimpl.AbstractBuiltResponsepublic <U> U readEntity(javax.ws.rs.core.GenericType<U> entityType,
Annotation[] annotations)
readEntity in class org.jboss.resteasy.specimpl.AbstractBuiltResponsepublic boolean hasEntity()
hasEntity in class org.jboss.resteasy.specimpl.AbstractBuiltResponsepublic boolean bufferEntity()
bufferEntity in class org.jboss.resteasy.specimpl.BuiltResponsepublic void close()
GenericResponseclose in interface GenericResponse<T>close in interface Closeableclose in interface AutoCloseableclose in class org.jboss.resteasy.specimpl.AbstractBuiltResponseResponse.close()public javax.ws.rs.core.MediaType getMediaType()
GenericResponsenull of there is no response entity.getMediaType in interface GenericResponse<T>getMediaType in class org.jboss.resteasy.specimpl.AbstractBuiltResponsepublic Locale getLanguage()
GenericResponsenull if not specified.getLanguage in interface GenericResponse<T>getLanguage in class org.jboss.resteasy.specimpl.AbstractBuiltResponsepublic int getLength()
GenericResponseContent-Length of the response if present, -1 otherwise.getLength in interface GenericResponse<T>getLength in class org.jboss.resteasy.specimpl.AbstractBuiltResponsepublic Set<String> getAllowedMethods()
GenericResponsegetAllowedMethods in interface GenericResponse<T>getAllowedMethods in class org.jboss.resteasy.specimpl.AbstractBuiltResponsepublic Map<String,javax.ws.rs.core.NewCookie> getCookies()
GenericResponsegetCookies in interface GenericResponse<T>getCookies in class org.jboss.resteasy.specimpl.AbstractBuiltResponsepublic javax.ws.rs.core.EntityTag getEntityTag()
GenericResponsegetEntityTag in interface GenericResponse<T>getEntityTag in class org.jboss.resteasy.specimpl.AbstractBuiltResponsepublic Date getDate()
GenericResponsenull if not present.getDate in interface GenericResponse<T>getDate in class org.jboss.resteasy.specimpl.AbstractBuiltResponsepublic Date getLastModified()
GenericResponsenull if not present.getLastModified in interface GenericResponse<T>getLastModified in class org.jboss.resteasy.specimpl.AbstractBuiltResponsepublic URI getLocation()
GenericResponsenull if not present.getLocation in interface GenericResponse<T>getLocation in class org.jboss.resteasy.specimpl.AbstractBuiltResponsepublic Set<javax.ws.rs.core.Link> getLinks()
GenericResponsegetLinks in interface GenericResponse<T>getLinks in class org.jboss.resteasy.specimpl.AbstractBuiltResponseResponse.getLinks()public boolean hasLink(String relation)
GenericResponsehasLink in interface GenericResponse<T>hasLink in class org.jboss.resteasy.specimpl.AbstractBuiltResponsepublic javax.ws.rs.core.Link getLink(String relation)
GenericResponsenull if not present.getLink in interface GenericResponse<T>getLink in class org.jboss.resteasy.specimpl.AbstractBuiltResponseResponse.getLink(String)public javax.ws.rs.core.Link.Builder getLinkBuilder(String relation)
GenericResponsenull if not present.getLinkBuilder in interface GenericResponse<T>getLinkBuilder in class org.jboss.resteasy.specimpl.AbstractBuiltResponseResponse.getLinkBuilder(String)public javax.ws.rs.core.MultivaluedMap<String,Object> getMetadata()
getMetadata in class org.jboss.resteasy.specimpl.AbstractBuiltResponsepublic javax.ws.rs.core.MultivaluedMap<String,String> getStringHeaders()
GenericResponsegetStringHeaders in interface GenericResponse<T>getStringHeaders in class org.jboss.resteasy.specimpl.AbstractBuiltResponseResponse.getStringHeaders(),
GenericResponse.getHeaders(),
GenericResponse.getHeaderString(java.lang.String)public javax.ws.rs.core.MultivaluedMap<String,Object> getHeaders()
GenericResponsegetHeaders in interface GenericResponse<T>getHeaders in class javax.ws.rs.core.ResponseResponse.getHeaders(),
GenericResponse.getStringHeaders(),
GenericResponse.getHeaderString(java.lang.String)public String getHeaderString(String name)
GenericResponseIf the header contains multiple values, they will be joined by a ',' character,
null if the header is not present.
getHeaderString in interface GenericResponse<T>getHeaderString in class org.jboss.resteasy.specimpl.AbstractBuiltResponseResponse.getHeaderString(String),
GenericResponse.getHeaders(),
GenericResponse.getHeaderString(java.lang.String)Copyright © 2020 Cerner Innovation, Inc.. All rights reserved.