|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.glassfish.jersey.message.internal.InboundMessageContext
public class InboundMessageContext
Base inbound message context implementation.
Constructor Summary | |
---|---|
InboundMessageContext()
Create new inbound message context. |
|
InboundMessageContext(boolean translateNce)
Create new inbound message context. |
Method Summary | ||
---|---|---|
boolean |
bufferEntity()
Buffer the entity stream (if not empty). |
|
void |
close()
Closes the underlying content stream. |
|
Set<String> |
getAllowedMethods()
Get the allowed HTTP methods from the Allow HTTP header. |
|
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 message headers multivalued map. |
|
String |
getHeaderString(String name)
Get a message header as a single string value. |
|
Set<MatchingEntityTag> |
getIfMatch()
Get If-Match header. |
|
Set<MatchingEntityTag> |
getIfNoneMatch()
Get If-None-Match header. |
|
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. |
|
List<AcceptableLanguageTag> |
getQualifiedAcceptableLanguages()
Get a list of languages that are acceptable for the message. |
|
List<AcceptableMediaType> |
getQualifiedAcceptableMediaTypes()
Get a list of media types that are acceptable for a request. |
|
List<AcceptableToken> |
getQualifiedAcceptCharset()
Get the list of language tag from the "Accept-Charset" of an HTTP request. |
|
List<AcceptableToken> |
getQualifiedAcceptEncoding()
Get the list of language tag from the "Accept-Charset" of an HTTP request. |
|
Map<String,Cookie> |
getRequestCookies()
Get any cookies that accompanied the request. |
|
Map<String,NewCookie> |
getResponseCookies()
Get any new cookies set on the response message. |
|
MessageBodyWorkers |
getWorkers()
Get context message body workers. |
|
boolean |
hasEntity()
Check if there is a non-empty entity input stream is available in the message. |
|
boolean |
hasLink(String relation)
Check if link for relation exists. |
|
InboundMessageContext |
header(String name,
Object value)
Add a new header value. |
|
InboundMessageContext |
headers(Map<String,List<String>> newHeaders)
Add new headers. |
|
InboundMessageContext |
headers(MultivaluedMap<String,String> newHeaders)
Add new headers. |
|
InboundMessageContext |
headers(String name,
Iterable<?> values)
Add new header values. |
|
InboundMessageContext |
headers(String name,
Object... values)
Add new header values. |
|
|
readEntity(Class<T> rawType,
Annotation[] annotations,
PropertiesDelegate propertiesDelegate)
Read entity from a context entity input stream. |
|
|
readEntity(Class<T> rawType,
PropertiesDelegate propertiesDelegate)
Read entity from a context entity input stream. |
|
|
readEntity(Class<T> rawType,
Type type,
Annotation[] annotations,
PropertiesDelegate propertiesDelegate)
Read entity from a context entity input stream. |
|
|
readEntity(Class<T> rawType,
Type type,
PropertiesDelegate propertiesDelegate)
Read entity from a context entity input stream. |
|
InboundMessageContext |
remove(String name)
Remove a header. |
|
void |
setEntityStream(InputStream input)
Set a new entity input stream. |
|
void |
setReaderInterceptors(Value<Iterable<ReaderInterceptor>> readerInterceptors)
Set reader interceptors for reading entity from this context. |
|
void |
setWorkers(MessageBodyWorkers workers)
Set context message body workers. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public InboundMessageContext()
public InboundMessageContext(boolean translateNce)
translateNce
- if true
, the NoContentException
thrown by a
selected message body reader will be translated into a BadRequestException
as required by JAX-RS specification on the server side.Method Detail |
---|
public InboundMessageContext header(String name, Object value)
name
- header name.value
- header value.
public InboundMessageContext headers(String name, Object... values)
name
- header name.values
- header values.
public InboundMessageContext headers(String name, Iterable<?> values)
name
- header name.values
- header values.
public InboundMessageContext headers(MultivaluedMap<String,String> newHeaders)
newHeaders
- new headers.
public InboundMessageContext headers(Map<String,List<String>> newHeaders)
newHeaders
- new headers.
public InboundMessageContext remove(String name)
name
- header name.
public String getHeaderString(String name)
RuntimeDelegate.HeaderDelegate
if one is available
via RuntimeDelegate.createHeaderDelegate(java.lang.Class)
for the header value class or using its toString
method if a header
delegate is not available.
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.public MultivaluedMap<String,String> getHeaders()
public Date getDate()
null
if not present.public Set<MatchingEntityTag> getIfMatch()
null
if not present.public Set<MatchingEntityTag> getIfNoneMatch()
null
if not present.public Locale getLanguage()
null
if not specifiedpublic int getLength()
public MediaType getMediaType()
null
if not specified (e.g. there's no
message entity).public List<AcceptableMediaType> getQualifiedAcceptableMediaTypes()
public List<AcceptableLanguageTag> getQualifiedAcceptableLanguages()
public List<AcceptableToken> getQualifiedAcceptCharset()
public List<AcceptableToken> getQualifiedAcceptEncoding()
public Map<String,Cookie> getRequestCookies()
Cookie
.public Set<String> getAllowedMethods()
public Map<String,NewCookie> getResponseCookies()
new cookie
.public EntityTag getEntityTag()
null
if not present.public Date getLastModified()
null
if not present.public URI getLocation()
null
if not present.public Set<Link> getLinks()
Set
if no links are present. Never
returns null
.public boolean hasLink(String relation)
relation
- link relation.
true
if the for the relation link exists, false
otherwise.public Link getLink(String relation)
relation
- link relation.
null
if not present.public Link.Builder getLinkBuilder(String relation)
Link.Builder
for the relation.
relation
- link relation.
null
if not
present.public MessageBodyWorkers getWorkers()
public void setWorkers(MessageBodyWorkers workers)
workers
- context message body workers.public boolean hasEntity()
true
if the entity is present, returns
false
otherwise.
true
if there is an entity present in the message,
false
otherwise.public InputStream getEntityStream()
public void setEntityStream(InputStream input)
input
- new entity input stream.public <T> T readEntity(Class<T> rawType, PropertiesDelegate propertiesDelegate)
T
- entity Java object type.rawType
- raw Java entity type.propertiesDelegate
- request-scoped properties delegate.
public <T> T readEntity(Class<T> rawType, Annotation[] annotations, PropertiesDelegate propertiesDelegate)
T
- entity Java object type.rawType
- raw Java entity type.annotations
- entity annotations.propertiesDelegate
- request-scoped properties delegate.
public <T> T readEntity(Class<T> rawType, Type type, PropertiesDelegate propertiesDelegate)
T
- entity Java object type.rawType
- raw Java entity type.type
- generic Java entity type.propertiesDelegate
- request-scoped properties delegate.
public <T> T readEntity(Class<T> rawType, Type type, Annotation[] annotations, PropertiesDelegate propertiesDelegate)
T
- entity Java object type.rawType
- raw Java entity type.type
- generic Java entity type.annotations
- entity annotations.propertiesDelegate
- request-scoped properties delegate.
public boolean bufferEntity() throws ProcessingException
true
if the entity input stream was successfully buffered.
ProcessingException
- in case of an IO error.public void close()
public void setReaderInterceptors(Value<Iterable<ReaderInterceptor>> readerInterceptors)
readerInterceptors
- A value that returns reader interceptors in the interceptor execution order.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |