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() |
abortIfClosed, addMethodAnnotations, getAnnotations, getHeaderValueProcessor, getLinkHeaders, getReasonPhrase, isClosed, readEntity, setAnnotations, setEntity, setEntityClass, setGenericType, setMetadata, setReasonPhrase, setStatus, toHeaderString
public 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()
GenericResponse
GenericResponse.getStatus()
is in the range [200..300), false otherwise.isSuccessful
in interface GenericResponse<T>
public T body()
GenericResponse
null
if no entity body is present.body
in interface GenericResponse<T>
public ErrorBody errorBody()
GenericResponse
null
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.BuiltResponse
public Type getGenericType()
getGenericType
in class org.jboss.resteasy.specimpl.BuiltResponse
public int getStatus()
GenericResponse
getStatus
in interface GenericResponse<T>
getStatus
in class org.jboss.resteasy.specimpl.BuiltResponse
public javax.ws.rs.core.Response.StatusType getStatusInfo()
GenericResponse
getStatusInfo
in interface GenericResponse<T>
getStatusInfo
in class org.jboss.resteasy.specimpl.BuiltResponse
public Object getEntity()
getEntity
in class org.jboss.resteasy.specimpl.BuiltResponse
public <U> U readEntity(Class<U> entityType)
readEntity
in class org.jboss.resteasy.specimpl.BuiltResponse
public <U> U readEntity(javax.ws.rs.core.GenericType<U> entityType)
readEntity
in class org.jboss.resteasy.specimpl.BuiltResponse
public <U> U readEntity(Class<U> entityType, Annotation[] annotations)
readEntity
in class org.jboss.resteasy.specimpl.BuiltResponse
public <U> U readEntity(javax.ws.rs.core.GenericType<U> entityType, Annotation[] annotations)
readEntity
in class org.jboss.resteasy.specimpl.BuiltResponse
public boolean hasEntity()
hasEntity
in class org.jboss.resteasy.specimpl.BuiltResponse
public boolean bufferEntity()
bufferEntity
in class org.jboss.resteasy.specimpl.BuiltResponse
public void close()
GenericResponse
close
in interface GenericResponse<T>
close
in interface Closeable
close
in interface AutoCloseable
close
in class org.jboss.resteasy.specimpl.BuiltResponse
Response.close()
public javax.ws.rs.core.MediaType getMediaType()
GenericResponse
null
of there is no response entity.getMediaType
in interface GenericResponse<T>
getMediaType
in class org.jboss.resteasy.specimpl.BuiltResponse
public Locale getLanguage()
GenericResponse
null
if not specified.getLanguage
in interface GenericResponse<T>
getLanguage
in class org.jboss.resteasy.specimpl.BuiltResponse
public int getLength()
GenericResponse
Content-Length
of the response if present, -1
otherwise.getLength
in interface GenericResponse<T>
getLength
in class org.jboss.resteasy.specimpl.BuiltResponse
public Set<String> getAllowedMethods()
GenericResponse
getAllowedMethods
in interface GenericResponse<T>
getAllowedMethods
in class org.jboss.resteasy.specimpl.BuiltResponse
public Map<String,javax.ws.rs.core.NewCookie> getCookies()
GenericResponse
getCookies
in interface GenericResponse<T>
getCookies
in class org.jboss.resteasy.specimpl.BuiltResponse
public javax.ws.rs.core.EntityTag getEntityTag()
GenericResponse
getEntityTag
in interface GenericResponse<T>
getEntityTag
in class org.jboss.resteasy.specimpl.BuiltResponse
public Date getDate()
GenericResponse
null
if not present.getDate
in interface GenericResponse<T>
getDate
in class org.jboss.resteasy.specimpl.BuiltResponse
public Date getLastModified()
GenericResponse
null
if not present.getLastModified
in interface GenericResponse<T>
getLastModified
in class org.jboss.resteasy.specimpl.BuiltResponse
public URI getLocation()
GenericResponse
null
if not present.getLocation
in interface GenericResponse<T>
getLocation
in class org.jboss.resteasy.specimpl.BuiltResponse
public Set<javax.ws.rs.core.Link> getLinks()
GenericResponse
getLinks
in interface GenericResponse<T>
getLinks
in class org.jboss.resteasy.specimpl.BuiltResponse
Response.getLinks()
public boolean hasLink(String relation)
GenericResponse
hasLink
in interface GenericResponse<T>
hasLink
in class org.jboss.resteasy.specimpl.BuiltResponse
public javax.ws.rs.core.Link getLink(String relation)
GenericResponse
null
if not present.getLink
in interface GenericResponse<T>
getLink
in class org.jboss.resteasy.specimpl.BuiltResponse
Response.getLink(String)
public javax.ws.rs.core.Link.Builder getLinkBuilder(String relation)
GenericResponse
null
if not present.getLinkBuilder
in interface GenericResponse<T>
getLinkBuilder
in class org.jboss.resteasy.specimpl.BuiltResponse
Response.getLinkBuilder(String)
public javax.ws.rs.core.MultivaluedMap<String,Object> getMetadata()
getMetadata
in class org.jboss.resteasy.specimpl.BuiltResponse
public javax.ws.rs.core.MultivaluedMap<String,String> getStringHeaders()
GenericResponse
getStringHeaders
in interface GenericResponse<T>
getStringHeaders
in class org.jboss.resteasy.specimpl.BuiltResponse
Response.getStringHeaders()
,
GenericResponse.getHeaders()
,
GenericResponse.getHeaderString(java.lang.String)
public javax.ws.rs.core.MultivaluedMap<String,Object> getHeaders()
GenericResponse
getHeaders
in interface GenericResponse<T>
getHeaders
in class javax.ws.rs.core.Response
Response.getHeaders()
,
GenericResponse.getStringHeaders()
,
GenericResponse.getHeaderString(java.lang.String)
public String getHeaderString(String name)
GenericResponse
If 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.BuiltResponse
Response.getHeaderString(String)
,
GenericResponse.getHeaders()
,
GenericResponse.getHeaderString(java.lang.String)
Copyright © 2019 Cerner Innovation, Inc.. All rights reserved.