Top Description Methods
javax.ws.rs.client

public Interface ClientResponseContext

Imports
java.io.InputStream, java.net.URI, java.util.Date, .Locale, .Map, .Set, javax.ws.rs.core.EntityTag, .Link, .MediaType, .MultivaluedMap, .NewCookie, .Response

Client response filter context. A mutable class that provides response-specific information for the filter, such as message headers, message entity or request-scoped properties. The exposed setters allow modification of the exposed response-specific information.
Author
Marek Potociar
Since
2.0

Method Summary

Modifier and TypeMethod and Description
public Set<String>

Returns:

the allowed HTTP methods, all methods will returned as upper case strings.
getAllowedMethods
()

Get the allowed HTTP methods from the Allow HTTP header.

public Map<String, NewCookie>

Returns:

a read-only map of cookie name (String) to a new cookie.
getCookies
()

Get any new cookies set on the response message.

public Date

Returns:

the message date, otherwise null if not present.
getDate
()

Get message date.

public InputStream

Returns:

entity input stream.
getEntityStream
()

Get the entity input stream.

public EntityTag

Returns:

the entity tag, otherwise null if not present.
getEntityTag
()

Get the entity tag.

public MultivaluedMap<String, String>

Returns:

mutable multivalued map of response headers.
getHeaders
()

Get the mutable response headers multivalued map.

public String

Returns:

the message header value. If the message header is not present then null is 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.
getHeaderString
(String
the message header.
name
)

Get a message header as a single string value.

public Locale

Returns:

the language of the entity or null if not specified
getLanguage
()

Get the language of the entity.

public Date

Returns:

the last modified date, otherwise null if not present.
getLastModified
()

Get the last modified date.

public int

Returns:

Content-Length as integer if present and valid number. In other cases returns -1.
getLength
()

Get Content-Length value.

public Link.Builder

Returns:

the link builder for the relation, otherwise null if not present.
getLinkBuilder
(String
link relation.
relation
)

Convenience method that returns a Link.Builder for the relation.

public URI

Returns:

the location URI, otherwise null if not present.
getLocation
()

Get the location.

public MediaType

Returns:

the media type or null if not specified (e.g. there's no response entity).
getMediaType
()

Get the media type of the entity.

public int

Returns:

the response status code or -1 if the status was not set.
getStatus
()

Get the status code associated with the response.

public Response.StatusType

Returns:

the response status information or null if the status was not set.
getStatusInfo
()

Get the complete status information associated with the response.

public boolean

Returns:

true if there is an entity present in the message, false otherwise.
hasEntity
()

Check if there is a non-empty entity input stream is available in the response message.

public void
setEntityStream(InputStream
new entity input stream.
input
)

Set a new entity input stream.

public void
setStatus(int
new status code.
code
)

Set a new response status code.

public void
setStatusInfo(Response.StatusType
the response status information.
statusInfo
)

Set the complete status information (status code and reason phrase) associated with the response.

Method Detail

getAllowedMethodsback to summary
public Set<String> getAllowedMethods()

Get the allowed HTTP methods from the Allow HTTP header.

Returns:Set<String>

the allowed HTTP methods, all methods will returned as upper case strings.

getCookiesback to summary
public Map<String, NewCookie> getCookies()

Get any new cookies set on the response message.

Returns:Map<String, NewCookie>

a read-only map of cookie name (String) to a new cookie.

getDateback to summary
public Date getDate()

Get message date.

Returns:Date

the message date, otherwise null if not present.

getEntityStreamback to summary
public InputStream getEntityStream()

Get the entity input stream. The JAX-RS runtime is responsible for closing the input stream.

Returns:InputStream

entity input stream.

getEntityTagback to summary
public EntityTag getEntityTag()

Get the entity tag.

Returns:EntityTag

the entity tag, otherwise null if not present.

getHeadersback to summary
public MultivaluedMap<String, String> getHeaders()

Get the mutable response headers multivalued map.

Returns:MultivaluedMap<String, String>

mutable multivalued map of response headers.

See Also
getHeaderString(String)
getHeaderStringback to summary
public String getHeaderString(String name)

Get a message header as a single string value.

Parameters
name:String

the message header.

Returns:String

the message header value. If the message header is not present then null is 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
getHeaders()
getLanguageback to summary
public Locale getLanguage()

Get the language of the entity.

Returns:Locale

the language of the entity or null if not specified

getLastModifiedback to summary
public Date getLastModified()

Get the last modified date.

Returns:Date

the last modified date, otherwise null if not present.

getLengthback to summary
public int getLength()

Get Content-Length value.

Returns:int

Content-Length as integer if present and valid number. In other cases returns -1.

getLinkBuilderback to summary
public Link.Builder getLinkBuilder(String relation)

Convenience method that returns a Link.Builder for the relation.

Parameters
relation:String

link relation.

Returns:Link.Builder

the link builder for the relation, otherwise null if not present.

getLocationback to summary
public URI getLocation()

Get the location.

Returns:URI

the location URI, otherwise null if not present.

getMediaTypeback to summary
public MediaType getMediaType()

Get the media type of the entity.

Returns:MediaType

the media type or null if not specified (e.g. there's no response entity).

getStatusback to summary
public int getStatus()

Get the status code associated with the response.

Returns:int

the response status code or -1 if the status was not set.

getStatusInfoback to summary
public Response.StatusType getStatusInfo()

Get the complete status information associated with the response.

Returns:Response.StatusType

the response status information or null if the status was not set.

hasEntityback to summary
public boolean hasEntity()

Check if there is a non-empty entity input stream is available in the response message. The method returns true if the entity is present, returns false otherwise.

Returns:boolean

true if there is an entity present in the message, false otherwise.

setEntityStreamback to summary
public void setEntityStream(InputStream input)

Set a new entity input stream. The JAX-RS runtime is responsible for closing the input stream.

Parameters
input:InputStream

new entity input stream.

setStatusback to summary
public void setStatus(int code)

Set a new response status code.

Parameters
code:int

new status code.

setStatusInfoback to summary
public void setStatusInfo(Response.StatusType statusInfo)

Set the complete status information (status code and reason phrase) associated with the response.

Parameters
statusInfo:Response.StatusType

the response status information.