public abstract class InboundMessageContext extends Object
Constructor and Description |
---|
InboundMessageContext()
Deprecated.
|
InboundMessageContext(boolean translateNce)
Deprecated.
|
InboundMessageContext(Configuration configuration)
Create new inbound message context.
|
InboundMessageContext(Configuration configuration,
boolean translateNce)
Create new inbound message context.
|
Modifier and Type | Method and Description |
---|---|
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.
|
Configuration |
getConfiguration()
The related client/server side
Configuration . |
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.
|
protected abstract Iterable<ReaderInterceptor> |
getReaderInterceptors()
Get reader interceptors bound to this context.
|
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.
|
<T> T |
readEntity(Class<T> rawType,
Annotation[] annotations,
PropertiesDelegate propertiesDelegate)
Read entity from a context entity input stream.
|
<T> T |
readEntity(Class<T> rawType,
PropertiesDelegate propertiesDelegate)
Read entity from a context entity input stream.
|
<T> T |
readEntity(Class<T> rawType,
Type type,
Annotation[] annotations,
PropertiesDelegate propertiesDelegate)
Read entity from a context entity input stream.
|
<T> T |
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 |
setWorkers(MessageBodyWorkers workers)
Set context message body workers.
|
public InboundMessageContext(Configuration configuration)
configuration
- the related client/server side Configuration
public InboundMessageContext(Configuration configuration, boolean translateNce)
configuration
- the related client/server side Configuration
. If null
,
the default behaviour is expected.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.@Deprecated public InboundMessageContext()
InboundMessageContext(Configuration)
@Deprecated 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. *InboundMessageContext(Configuration)
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 specified.public 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()
protected abstract Iterable<ReaderInterceptor> getReaderInterceptors()
Interceptors will be used when one of the readEntity
methods is invoked.
public Configuration getConfiguration()
Configuration
. Can be null
.Configuration
the configurationCopyright © 2007-2023, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.