public class BaseClientResponse<T> extends ClientResponse<T>
| Modifier and Type | Class and Description |
|---|---|
static interface |
BaseClientResponse.BaseClientResponseStreamFactory |
Response.ResponseBuilder, Response.Status, Response.StatusType| Modifier and Type | Field and Description |
|---|---|
protected String |
alternateMediaType |
protected Annotation[] |
annotations |
protected String |
attributeExceptionsTo |
protected Map<String,Object> |
attributes |
protected Exception |
exception |
protected ClientExecutor |
executor |
protected Type |
genericReturnType |
protected MultivaluedMap<String,String> |
headers |
protected LinkHeader |
linkHeader |
protected Link |
location |
protected MessageBodyReaderInterceptor[] |
messageBodyReaderInterceptors |
protected ResteasyProviderFactory |
providerFactory |
protected Class<?> |
returnType |
protected int |
status |
protected BaseClientResponse.BaseClientResponseStreamFactory |
streamFactory |
protected Object |
unmarshaledEntity |
protected boolean |
wasReleased |
| Constructor and Description |
|---|
BaseClientResponse(BaseClientResponse.BaseClientResponseStreamFactory streamFactory) |
BaseClientResponse(BaseClientResponse.BaseClientResponseStreamFactory streamFactory,
ClientExecutor executor) |
| Modifier and Type | Method and Description |
|---|---|
void |
checkFailureStatus() |
static ClientResponse |
copyFromError(ClientResponse copy)
Store entity within a byte array input stream because we want to release the connection
if a ClientResponseFailure is thrown.
|
ClientResponseFailure |
createResponseFailure(String message) |
ClientResponseFailure |
createResponseFailure(String message,
Exception e) |
protected void |
finalize() |
Annotation[] |
getAnnotations() |
String |
getAttributeExceptionsTo() |
Map<String,Object> |
getAttributes()
Used to pass information to and between interceptors.
|
T |
getEntity()
Unmarshal the target entity from the response OutputStream.
|
<T2> T2 |
getEntity(Class<T2> type)
Extract the response body with the provided type information
This method actually does the reading on the OutputStream.
|
<T2> T2 |
getEntity(Class<T2> type,
Type genericType)
Extract the response body with the provided type information
This method actually does the reading on the OutputStream.
|
<T2> T2 |
getEntity(Class<T2> type,
Type genericType,
Annotation[] anns) |
<T2> T2 |
getEntity(GenericType<T2> genericType)
Extract the response body with the provided type information.
|
<T2> T2 |
getEntity(GenericType<T2> genericType,
Annotation[] ann) |
Exception |
getException() |
Link |
getHeaderAsLink(String headerName)
Header is assumed to be a URL, a Link object is created from it if it exists.
|
MultivaluedMap<String,String> |
getHeaders()
This method returns the same exact map as Response.getMetadata() except as a map of strings rather than objects
|
LinkHeader |
getLinkHeader()
Get the link headers of the response.
|
Link |
getLocation()
Get the Location header as a Link so you can easily execute on it.
|
protected MediaType |
getMediaType() |
MultivaluedMap<String,Object> |
getMetadata()
Get metadata associated with the response as a map.
|
String |
getResponseHeader(String headerKey) |
Response.Status |
getResponseStatus() |
Class<?> |
getReturnType() |
int |
getStatus()
Get the status code associated with the response.
|
BaseClientResponse.BaseClientResponseStreamFactory |
getStreamFactory() |
protected <T2> Object |
readFrom(Class<T2> type,
Type genericType,
MediaType media,
Annotation[] annotations) |
void |
releaseConnection() |
void |
resetStream()
Attempts to reset the InputStream of the response.
|
void |
setAlternateMediaType(String alternateMediaType) |
void |
setAnnotations(Annotation[] annotations) |
void |
setAttributeExceptionsTo(String attributeExceptionsTo) |
void |
setAttributes(Map<String,Object> attributes) |
void |
setException(Exception exception) |
void |
setGenericReturnType(Type genericReturnType) |
void |
setHeaders(MultivaluedMap<String,String> headers) |
void |
setMessageBodyReaderInterceptors(MessageBodyReaderInterceptor[] messageBodyReaderInterceptors) |
void |
setProviderFactory(ResteasyProviderFactory providerFactory) |
void |
setReturnType(Class<T> returnType) |
void |
setStatus(int status) |
void |
setStreamFactory(BaseClientResponse.BaseClientResponseStreamFactory streamFactory) |
boolean |
wasReleased() |
created, fromResponse, noContent, notAcceptable, notModified, notModified, notModified, ok, ok, ok, ok, ok, seeOther, serverError, status, status, status, temporaryRedirectprotected ResteasyProviderFactory providerFactory
protected String attributeExceptionsTo
protected MultivaluedMap<String,String> headers
protected String alternateMediaType
protected Class<?> returnType
protected Type genericReturnType
protected Annotation[] annotations
protected int status
protected boolean wasReleased
protected Object unmarshaledEntity
protected MessageBodyReaderInterceptor[] messageBodyReaderInterceptors
protected Exception exception
protected BaseClientResponse.BaseClientResponseStreamFactory streamFactory
protected LinkHeader linkHeader
protected Link location
protected ClientExecutor executor
public BaseClientResponse(BaseClientResponse.BaseClientResponseStreamFactory streamFactory, ClientExecutor executor)
public BaseClientResponse(BaseClientResponse.BaseClientResponseStreamFactory streamFactory)
public static ClientResponse copyFromError(ClientResponse copy)
copy - public Map<String,Object> getAttributes()
ClientResponsegetAttributes in class ClientResponse<T>public void setMessageBodyReaderInterceptors(MessageBodyReaderInterceptor[] messageBodyReaderInterceptors)
public void setStatus(int status)
public void setHeaders(MultivaluedMap<String,String> headers)
public void setProviderFactory(ResteasyProviderFactory providerFactory)
public Class<?> getReturnType()
public void setGenericReturnType(Type genericReturnType)
public void setAnnotations(Annotation[] annotations)
public String getAttributeExceptionsTo()
public void setAttributeExceptionsTo(String attributeExceptionsTo)
public Exception getException()
public void setException(Exception exception)
public Annotation[] getAnnotations()
public LinkHeader getLinkHeader()
ClientResponsegetLinkHeader in class ClientResponse<T>public Link getLocation()
ClientResponsegetLocation in class ClientResponse<T>public Link getHeaderAsLink(String headerName)
ClientResponsegetHeaderAsLink in class ClientResponse<T>public void setAlternateMediaType(String alternateMediaType)
public BaseClientResponse.BaseClientResponseStreamFactory getStreamFactory()
public void setStreamFactory(BaseClientResponse.BaseClientResponseStreamFactory streamFactory)
public void resetStream()
ClientResponseresetStream in class ClientResponse<T>public T getEntity()
ClientResponsegetEntity in class ClientResponse<T>MessageBodyWriterpublic <T2> T2 getEntity(Class<T2> type)
ClientResponsegetEntity in class ClientResponse<T>public <T2> T2 getEntity(Class<T2> type, Type genericType)
ClientResponsegetEntity in class ClientResponse<T>public <T2> T2 getEntity(Class<T2> type, Type genericType, Annotation[] anns)
getEntity in class ClientResponse<T>protected MediaType getMediaType()
protected <T2> Object readFrom(Class<T2> type, Type genericType, MediaType media, Annotation[] annotations)
public <T2> T2 getEntity(GenericType<T2> genericType)
ClientResponseListlist = response.getEntity(new GenericType () {}); This method actually does the reading on the OutputStream. It will only do the read once. Afterwards, it will cache the result and return the cached result.
getEntity in class ClientResponse<T>public <T2> T2 getEntity(GenericType<T2> genericType, Annotation[] ann)
getEntity in class ClientResponse<T>public MultivaluedMap<String,String> getHeaders()
ClientResponsegetHeaders in class ClientResponse<T>public MultivaluedMap<String,Object> getMetadata()
ResponseRuntimeDelegate.HeaderDelegate
if one is available via
RuntimeDelegate.createHeaderDelegate(java.lang.Class)
for the class of the value or using the values toString method if a
header delegate is not available.getMetadata in class Responsepublic int getStatus()
Responsepublic void checkFailureStatus()
public ClientResponseFailure createResponseFailure(String message)
public ClientResponseFailure createResponseFailure(String message, Exception e)
public Response.Status getResponseStatus()
getResponseStatus in class ClientResponse<T>public boolean wasReleased()
public final void releaseConnection()
releaseConnection in class ClientResponse<T>Copyright © 2014. All Rights Reserved.