public abstract class InboundMessageContext extends MessageHeaderMethods
runtimeDelegateDecorator
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.
|
Configuration |
getConfiguration()
The related client/server side
Configuration . |
InputStream |
getEntityStream()
Get the entity input stream.
|
MultivaluedMap<String,String> |
getHeaders()
Get the mutable message headers multivalued map.
|
String |
getHeaderString(String name)
Get a message header as a single string value.
|
HeaderValueException.Context |
getHeaderValueExceptionContext()
Return
HeaderValueException.Context type of the message context. |
Set<MatchingEntityTag> |
getIfMatch()
Get If-Match header.
|
Set<MatchingEntityTag> |
getIfNoneMatch()
Get If-None-Match header.
|
Set<Link> |
getLinks()
Get the links attached to the message as header.
|
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.
|
MessageBodyWorkers |
getWorkers()
Get context message body workers.
|
boolean |
hasEntity()
Check if there is a non-empty entity input stream is available in the
message.
|
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.
|
containsHeaderString, containsHeaderString, exception, getAllowedMethods, getDate, getEntityTag, getLanguage, getLastModified, getLength, getLengthLong, getLink, getLinkBuilder, getLocation, getRequestCookies, getResponseCookies, hasLink, singleHeader, singleHeader
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.getHeaderString
in class MessageHeaderMethods
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 HeaderValueException.Context getHeaderValueExceptionContext()
MessageHeaderMethods
HeaderValueException.Context
type of the message context.getHeaderValueExceptionContext
in class MessageHeaderMethods
HeaderValueException.Context
type of the message context.public MultivaluedMap<String,String> getHeaders()
getHeaders
in class MessageHeaderMethods
public Set<MatchingEntityTag> getIfMatch()
null
if not present.public Set<MatchingEntityTag> getIfNoneMatch()
null
if not present.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 Set<Link> getLinks()
getLinks
in class MessageHeaderMethods
Set
if no links are present. Never
returns null
.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-2024, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.