public class ClientResponseContextImpl extends Object implements ClientResponseContext
Modifier and Type | Field and Description |
---|---|
protected ClientResponse |
response |
Constructor and Description |
---|
ClientResponseContextImpl(ClientResponse response) |
Modifier and Type | Method and Description |
---|---|
Set<String> |
getAllowedMethods()
Get the allowed HTTP methods from the Allow HTTP header.
|
ClientResponse |
getClientResponse() |
Map<String,NewCookie> |
getCookies()
Get any new cookies set on the response message.
|
Date |
getDate()
Get message date.
|
InputStream |
getEntityStream()
Get the entity input stream.
|
EntityTag |
getEntityTag()
Get the entity tag.
|
MultivaluedMap<String,String> |
getHeaders()
Get the mutable response headers multivalued map.
|
String |
getHeaderString(String name)
Get a message header as a single string value.
|
Locale |
getLanguage()
Get the language of the entity.
|
Date |
getLastModified()
Get the last modified date.
|
int |
getLength()
Get Content-Length value.
|
Link |
getLink(String relation)
Get the link for the relation.
|
Link.Builder |
getLinkBuilder(String relation)
Convenience method that returns a
Link.Builder
for the relation. |
Set<Link> |
getLinks()
Get the links attached to the message as header.
|
URI |
getLocation()
Get the location.
|
MediaType |
getMediaType()
Get the media type of the entity.
|
int |
getStatus()
Get the status code associated with the response.
|
Response.StatusType |
getStatusInfo()
Get the complete status information associated with the response.
|
boolean |
hasEntity()
Check if there is a non-empty entity input stream is available in the response
message.
|
boolean |
hasLink(String relation)
Check if link for relation exists.
|
void |
setEntityStream(InputStream entityStream)
Set a new entity input stream.
|
void |
setStatus(int code)
Set a new response status code.
|
void |
setStatusInfo(Response.StatusType statusInfo)
Set the complete status information (status code and reason phrase) associated
with the response.
|
protected final ClientResponse response
public ClientResponseContextImpl(ClientResponse response)
public int getStatus()
ClientResponseContext
getStatus
in interface ClientResponseContext
public void setStatus(int code)
ClientResponseContext
setStatus
in interface ClientResponseContext
code
- new status code.public Response.StatusType getStatusInfo()
ClientResponseContext
getStatusInfo
in interface ClientResponseContext
null
if the status was
not set.public void setStatusInfo(Response.StatusType statusInfo)
ClientResponseContext
setStatusInfo
in interface ClientResponseContext
statusInfo
- the response status information.public MultivaluedMap<String,String> getHeaders()
ClientResponseContext
getHeaders
in interface ClientResponseContext
ClientResponseContext.getHeaderString(String)
public Set<String> getAllowedMethods()
ClientResponseContext
getAllowedMethods
in interface ClientResponseContext
public Date getDate()
ClientResponseContext
getDate
in interface ClientResponseContext
null
if not present.public Locale getLanguage()
ClientResponseContext
getLanguage
in interface ClientResponseContext
null
if not specifiedpublic int getLength()
ClientResponseContext
getLength
in interface ClientResponseContext
public MediaType getMediaType()
ClientResponseContext
getMediaType
in interface ClientResponseContext
null
if not specified (e.g. there's no
response entity).public Map<String,NewCookie> getCookies()
ClientResponseContext
getCookies
in interface ClientResponseContext
new cookie
.public EntityTag getEntityTag()
ClientResponseContext
getEntityTag
in interface ClientResponseContext
null
if not present.public Date getLastModified()
ClientResponseContext
getLastModified
in interface ClientResponseContext
null
if not present.public URI getLocation()
ClientResponseContext
getLocation
in interface ClientResponseContext
null
if not present.public Set<Link> getLinks()
ClientResponseContext
getLinks
in interface ClientResponseContext
Set
if no links are present. Never
returns null
.public boolean hasLink(String relation)
ClientResponseContext
hasLink
in interface ClientResponseContext
relation
- link relation.true
if the for the relation link exists, false
otherwise.public Link getLink(String relation)
ClientResponseContext
getLink
in interface ClientResponseContext
relation
- link relation.null
if not present.public Link.Builder getLinkBuilder(String relation)
ClientResponseContext
Link.Builder
for the relation.getLinkBuilder
in interface ClientResponseContext
relation
- link relation.null
if not
present.public boolean hasEntity()
ClientResponseContext
true
if the entity is present, returns
false
otherwise.hasEntity
in interface ClientResponseContext
true
if there is an entity present in the message,
false
otherwise.public InputStream getEntityStream()
ClientResponseContext
getEntityStream
in interface ClientResponseContext
public void setEntityStream(InputStream entityStream)
ClientResponseContext
setEntityStream
in interface ClientResponseContext
entityStream
- new entity input stream.public String getHeaderString(String name)
ClientResponseContext
getHeaderString
in interface ClientResponseContext
name
- the message header.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.ClientResponseContext.getHeaders()
public ClientResponse getClientResponse()
Copyright © 2021 JBoss by Red Hat. All rights reserved.