Class ClientResponseContextImpl
- java.lang.Object
-
- org.jboss.resteasy.client.jaxrs.internal.ClientResponseContextImpl
-
- All Implemented Interfaces:
ClientResponseContext
public class ClientResponseContextImpl extends Object implements ClientResponseContext
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
-
Field Summary
Fields Modifier and Type Field Description protected ClientResponseresponse
-
Constructor Summary
Constructors Constructor Description ClientResponseContextImpl(ClientResponse response)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<String>getAllowedMethods()Get the allowed HTTP methods from the Allow HTTP header.ClientResponsegetClientResponse()Map<String,NewCookie>getCookies()Get any new cookies set on the response message.DategetDate()Get message date.InputStreamgetEntityStream()Get the entity input stream.EntityTaggetEntityTag()Get the entity tag.MultivaluedMap<String,String>getHeaders()Get the mutable response headers multivalued map.StringgetHeaderString(String name)Get a message header as a single string value.LocalegetLanguage()Get the language of the entity.DategetLastModified()Get the last modified date.intgetLength()Get Content-Length value.LinkgetLink(String relation)Get the link for the relation.Link.BuildergetLinkBuilder(String relation)Convenience method that returns aLink.Builderfor the relation.Set<Link>getLinks()Get the links attached to the message as header.URIgetLocation()Get the location.MediaTypegetMediaType()Get the media type of the entity.intgetStatus()Get the status code associated with the response.Response.StatusTypegetStatusInfo()Get the complete status information associated with the response.booleanhasEntity()Check if there is a non-empty entity input stream is available in the response message.booleanhasLink(String relation)Check if link for relation exists.voidsetEntityStream(InputStream entityStream)Set a new entity input stream.voidsetStatus(int code)Set a new response status code.voidsetStatusInfo(Response.StatusType statusInfo)Set the complete status information (status code and reason phrase) associated with the response.
-
-
-
Field Detail
-
response
protected final ClientResponse response
-
-
Constructor Detail
-
ClientResponseContextImpl
public ClientResponseContextImpl(ClientResponse response)
-
-
Method Detail
-
getStatus
public int getStatus()
Description copied from interface:ClientResponseContextGet the status code associated with the response.- Specified by:
getStatusin interfaceClientResponseContext- Returns:
- the response status code or -1 if the status was not set.
-
setStatus
public void setStatus(int code)
Description copied from interface:ClientResponseContextSet a new response status code.- Specified by:
setStatusin interfaceClientResponseContext- Parameters:
code- new status code.
-
getStatusInfo
public Response.StatusType getStatusInfo()
Description copied from interface:ClientResponseContextGet the complete status information associated with the response.- Specified by:
getStatusInfoin interfaceClientResponseContext- Returns:
- the response status information or
nullif the status was not set.
-
setStatusInfo
public void setStatusInfo(Response.StatusType statusInfo)
Description copied from interface:ClientResponseContextSet the complete status information (status code and reason phrase) associated with the response.- Specified by:
setStatusInfoin interfaceClientResponseContext- Parameters:
statusInfo- the response status information.
-
getHeaders
public MultivaluedMap<String,String> getHeaders()
Description copied from interface:ClientResponseContextGet the mutable response headers multivalued map.- Specified by:
getHeadersin interfaceClientResponseContext- Returns:
- mutable multivalued map of response headers.
- See Also:
ClientResponseContext.getHeaderString(String)
-
getAllowedMethods
public Set<String> getAllowedMethods()
Description copied from interface:ClientResponseContextGet the allowed HTTP methods from the Allow HTTP header.- Specified by:
getAllowedMethodsin interfaceClientResponseContext- Returns:
- the allowed HTTP methods, all methods will returned as upper case strings.
-
getDate
public Date getDate()
Description copied from interface:ClientResponseContextGet message date.- Specified by:
getDatein interfaceClientResponseContext- Returns:
- the message date, otherwise
nullif not present.
-
getLanguage
public Locale getLanguage()
Description copied from interface:ClientResponseContextGet the language of the entity.- Specified by:
getLanguagein interfaceClientResponseContext- Returns:
- the language of the entity or
nullif not specified
-
getLength
public int getLength()
Description copied from interface:ClientResponseContextGet Content-Length value.- Specified by:
getLengthin interfaceClientResponseContext- Returns:
- Content-Length as integer if present and valid number. In other cases returns -1.
-
getMediaType
public MediaType getMediaType()
Description copied from interface:ClientResponseContextGet the media type of the entity.- Specified by:
getMediaTypein interfaceClientResponseContext- Returns:
- the media type or
nullif not specified (e.g. there's no response entity).
-
getCookies
public Map<String,NewCookie> getCookies()
Description copied from interface:ClientResponseContextGet any new cookies set on the response message.- Specified by:
getCookiesin interfaceClientResponseContext- Returns:
- a read-only map of cookie name (String) to a
new cookie.
-
getEntityTag
public EntityTag getEntityTag()
Description copied from interface:ClientResponseContextGet the entity tag.- Specified by:
getEntityTagin interfaceClientResponseContext- Returns:
- the entity tag, otherwise
nullif not present.
-
getLastModified
public Date getLastModified()
Description copied from interface:ClientResponseContextGet the last modified date.- Specified by:
getLastModifiedin interfaceClientResponseContext- Returns:
- the last modified date, otherwise
nullif not present.
-
getLocation
public URI getLocation()
Description copied from interface:ClientResponseContextGet the location.- Specified by:
getLocationin interfaceClientResponseContext- Returns:
- the location URI, otherwise
nullif not present.
-
getLinks
public Set<Link> getLinks()
Description copied from interface:ClientResponseContextGet the links attached to the message as header.- Specified by:
getLinksin interfaceClientResponseContext- Returns:
- links, may return empty
Setif no links are present. Never returnsnull.
-
hasLink
public boolean hasLink(String relation)
Description copied from interface:ClientResponseContextCheck if link for relation exists.- Specified by:
hasLinkin interfaceClientResponseContext- Parameters:
relation- link relation.- Returns:
trueif the for the relation link exists,falseotherwise.
-
getLink
public Link getLink(String relation)
Description copied from interface:ClientResponseContextGet the link for the relation.- Specified by:
getLinkin interfaceClientResponseContext- Parameters:
relation- link relation.- Returns:
- the link for the relation, otherwise
nullif not present.
-
getLinkBuilder
public Link.Builder getLinkBuilder(String relation)
Description copied from interface:ClientResponseContextConvenience method that returns aLink.Builderfor the relation.- Specified by:
getLinkBuilderin interfaceClientResponseContext- Parameters:
relation- link relation.- Returns:
- the link builder for the relation, otherwise
nullif not present.
-
hasEntity
public boolean hasEntity()
Description copied from interface:ClientResponseContextCheck if there is a non-empty entity input stream is available in the response message. The method returnstrueif the entity is present, returnsfalseotherwise.- Specified by:
hasEntityin interfaceClientResponseContext- Returns:
trueif there is an entity present in the message,falseotherwise.
-
getEntityStream
public InputStream getEntityStream()
Description copied from interface:ClientResponseContextGet the entity input stream. The JAX-RS runtime is responsible for closing the input stream.- Specified by:
getEntityStreamin interfaceClientResponseContext- Returns:
- entity input stream.
-
setEntityStream
public void setEntityStream(InputStream entityStream)
Description copied from interface:ClientResponseContextSet a new entity input stream. The JAX-RS runtime is responsible for closing the input stream.- Specified by:
setEntityStreamin interfaceClientResponseContext- Parameters:
entityStream- new entity input stream.
-
getHeaderString
public String getHeaderString(String name)
Description copied from interface:ClientResponseContextGet a message header as a single string value.- Specified by:
getHeaderStringin interfaceClientResponseContext- Parameters:
name- the message header.- Returns:
- the message header value. If the message header is not present then
nullis returned. If the message header is present but has no value then the empty string is returned. If the message header is present more than once then the values of joined together and separated by a ',' character. - See Also:
ClientResponseContext.getHeaders()
-
getClientResponse
public ClientResponse getClientResponse()
-
-