public class BaseClientResponse<T> extends ClientResponse<T>
Modifier and Type | Class and Description |
---|---|
static interface |
BaseClientResponse.BaseClientResponseStreamFactory |
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 javax.ws.rs.core.MultivaluedMap<String,String> |
headers |
protected LinkHeader |
linkHeader |
protected Link |
location |
protected ResteasyProviderFactory |
providerFactory |
protected javax.ws.rs.ext.ReaderInterceptor[] |
readerInterceptors |
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 |
---|---|
boolean |
bufferEntity() |
void |
checkFailureStatus() |
void |
close() |
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() |
Set<String> |
getAllowedMethods() |
Annotation[] |
getAnnotations() |
String |
getAttributeExceptionsTo() |
Map<String,Object> |
getAttributes()
Used to pass information to and between interceptors.
|
Map<String,javax.ws.rs.core.NewCookie> |
getCookies() |
Date |
getDate() |
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) |
javax.ws.rs.core.EntityTag |
getEntityTag() |
Exception |
getException() |
Link |
getHeaderAsLink(String headerName)
Header is assumed to be a URL, a Link object is created from it if it exists.
|
String |
getHeaderString(String name) |
Locale |
getLanguage() |
Date |
getLastModified() |
int |
getLength() |
javax.ws.rs.core.Link |
getLink(String relation) |
javax.ws.rs.core.Link.Builder |
getLinkBuilder(String relation) |
LinkHeader |
getLinkHeader()
Get the link headers of the response.
|
Set<javax.ws.rs.core.Link> |
getLinks() |
URI |
getLocation() |
Link |
getLocationLink()
Get the Location header as a Link so you can easily execute on it.
|
javax.ws.rs.core.MediaType |
getMediaType() |
javax.ws.rs.core.MultivaluedMap<String,Object> |
getMetadata() |
String |
getResponseHeader(String headerKey) |
javax.ws.rs.core.MultivaluedMap<String,String> |
getResponseHeaders()
This method returns the same exact map as Response.getMetadata() except as a map of strings rather than objects
|
javax.ws.rs.core.Response.Status |
getResponseStatus() |
Class<?> |
getReturnType() |
int |
getStatus() |
javax.ws.rs.core.Response.StatusType |
getStatusInfo() |
BaseClientResponse.BaseClientResponseStreamFactory |
getStreamFactory() |
javax.ws.rs.core.MultivaluedMap<String,String> |
getStringHeaders() |
boolean |
hasEntity() |
boolean |
hasLink(String relation) |
<T> T |
readEntity(Class<T> entityType) |
<T> T |
readEntity(Class<T> entityType,
Annotation[] annotations) |
<T> T |
readEntity(javax.ws.rs.core.GenericType<T> entityType) |
<T> T |
readEntity(javax.ws.rs.core.GenericType<T> entityType,
Annotation[] annotations) |
protected <T2> Object |
readFrom(Class<T2> type,
Type genericType,
javax.ws.rs.core.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(javax.ws.rs.core.MultivaluedMap<String,String> headers) |
void |
setProviderFactory(ResteasyProviderFactory providerFactory) |
void |
setReaderInterceptors(javax.ws.rs.ext.ReaderInterceptor[] readerInterceptors) |
void |
setReturnType(Class<T> returnType) |
void |
setStatus(int status) |
void |
setStreamFactory(BaseClientResponse.BaseClientResponseStreamFactory streamFactory) |
void |
setWasReleased(boolean wasReleased) |
boolean |
wasReleased() |
protected ResteasyProviderFactory providerFactory
protected String attributeExceptionsTo
protected String alternateMediaType
protected Class<?> returnType
protected Type genericReturnType
protected Annotation[] annotations
protected int status
protected boolean wasReleased
protected Object unmarshaledEntity
protected javax.ws.rs.ext.ReaderInterceptor[] readerInterceptors
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()
ClientResponse
getAttributes
in class ClientResponse<T>
public void setReaderInterceptors(javax.ws.rs.ext.ReaderInterceptor[] readerInterceptors)
public void setStatus(int status)
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()
ClientResponse
getLinkHeader
in class ClientResponse<T>
public Link getLocationLink()
ClientResponse
getLocationLink
in class ClientResponse<T>
public Link getHeaderAsLink(String headerName)
ClientResponse
All Link objects returned will automatically have the same ClientExecutor as the request.
getHeaderAsLink
in class ClientResponse<T>
public void setAlternateMediaType(String alternateMediaType)
public BaseClientResponse.BaseClientResponseStreamFactory getStreamFactory()
public void setStreamFactory(BaseClientResponse.BaseClientResponseStreamFactory streamFactory)
public void resetStream()
ClientResponse
resetStream
in class ClientResponse<T>
public T getEntity()
ClientResponse
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(Class<T2> type)
ClientResponse
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(Class<T2> type, Type genericType)
ClientResponse
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(Class<T2> type, Type genericType, Annotation[] anns)
getEntity
in class ClientResponse<T>
public javax.ws.rs.core.MediaType getMediaType()
getMediaType
in class javax.ws.rs.core.Response
protected <T2> Object readFrom(Class<T2> type, Type genericType, javax.ws.rs.core.MediaType media, Annotation[] annotations)
public <T2> T2 getEntity(GenericType<T2> genericType)
ClientResponse
For example:
List <String > list = response.getEntity(new GenericType <List <String >>() {});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 javax.ws.rs.core.MultivaluedMap<String,String> getResponseHeaders()
ClientResponse
getResponseHeaders
in class ClientResponse<T>
public javax.ws.rs.core.MultivaluedMap<String,Object> getMetadata()
getMetadata
in class javax.ws.rs.core.Response
public int getStatus()
getStatus
in class javax.ws.rs.core.Response
public javax.ws.rs.core.Response.StatusType getStatusInfo()
getStatusInfo
in class javax.ws.rs.core.Response
public void checkFailureStatus()
public ClientResponseFailure createResponseFailure(String message)
public ClientResponseFailure createResponseFailure(String message, Exception e)
public javax.ws.rs.core.Response.Status getResponseStatus()
getResponseStatus
in class ClientResponse<T>
public boolean wasReleased()
public void setWasReleased(boolean wasReleased)
public final void releaseConnection()
releaseConnection
in class ClientResponse<T>
protected final void finalize() throws Throwable
public <T> T readEntity(Class<T> entityType)
readEntity
in class javax.ws.rs.core.Response
public <T> T readEntity(javax.ws.rs.core.GenericType<T> entityType)
readEntity
in class javax.ws.rs.core.Response
public <T> T readEntity(Class<T> entityType, Annotation[] annotations)
readEntity
in class javax.ws.rs.core.Response
public <T> T readEntity(javax.ws.rs.core.GenericType<T> entityType, Annotation[] annotations)
readEntity
in class javax.ws.rs.core.Response
public boolean hasEntity()
hasEntity
in class javax.ws.rs.core.Response
public boolean bufferEntity()
bufferEntity
in class javax.ws.rs.core.Response
public void close()
close
in interface AutoCloseable
close
in class javax.ws.rs.core.Response
public String getHeaderString(String name)
getHeaderString
in class javax.ws.rs.core.Response
public Locale getLanguage()
getLanguage
in class javax.ws.rs.core.Response
public int getLength()
getLength
in class javax.ws.rs.core.Response
public Map<String,javax.ws.rs.core.NewCookie> getCookies()
getCookies
in class javax.ws.rs.core.Response
public javax.ws.rs.core.EntityTag getEntityTag()
getEntityTag
in class javax.ws.rs.core.Response
public Date getDate()
getDate
in class javax.ws.rs.core.Response
public Date getLastModified()
getLastModified
in class javax.ws.rs.core.Response
public Set<javax.ws.rs.core.Link> getLinks()
getLinks
in class javax.ws.rs.core.Response
public boolean hasLink(String relation)
hasLink
in class javax.ws.rs.core.Response
public javax.ws.rs.core.Link getLink(String relation)
getLink
in class javax.ws.rs.core.Response
public javax.ws.rs.core.Link.Builder getLinkBuilder(String relation)
getLinkBuilder
in class javax.ws.rs.core.Response
public URI getLocation()
getLocation
in class javax.ws.rs.core.Response
public Set<String> getAllowedMethods()
getAllowedMethods
in class javax.ws.rs.core.Response
Copyright © 2018 JBoss by Red Hat. All rights reserved.