@Provider @Consumes(value={"application/json","application/*+json","text/json"}) @Produces(value={"application/json","application/*+json","text/json"}) public class ResteasyJackson2Provider extends JacksonJaxbJsonProvider
Modifier and Type | Field and Description |
---|---|
protected ConcurrentHashMap<org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider.ClassAnnotationKey,JsonEndpointConfig> |
_readers |
protected ConcurrentHashMap<org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider.ClassAnnotationKey,JsonEndpointConfig> |
_writers |
DEFAULT_ANNOTATIONS
_jsonpFunctionName, _providers, BASIC_ANNOTATIONS, MIME_JAVASCRIPT, MIME_JAVASCRIPT_MS
_cfgCheckCanDeserialize, _cfgCheckCanSerialize, _cfgCustomUntouchables, _defaultReadView, _defaultWriteView, _jaxRSFeatures, _mapperConfig, _noContentExceptionRef, _unreadableClasses, _untouchables, _unwritableClasses, CLASS_NAME_NO_CONTENT_EXCEPTION, DEFAULT_UNREADABLES, DEFAULT_UNTOUCHABLES, DEFAULT_UNWRITABLES, HEADER_CONTENT_TYPE_OPTIONS, JAXRS_FEATURE_DEFAULTS, noContentExceptionSupplier
Constructor and Description |
---|
ResteasyJackson2Provider() |
Modifier and Type | Method and Description |
---|---|
boolean |
isReadable(Class<?> aClass,
Type type,
Annotation[] annotations,
MediaType mediaType)
Method that JAX-RS container calls to try to check whether
values of given type (and media type) can be deserialized by
this provider.
|
boolean |
isWriteable(Class<?> aClass,
Type type,
Annotation[] annotations,
MediaType mediaType)
Method that JAX-RS container calls to try to check whether
given value (of specified type) can be serialized by
this provider.
|
Object |
readFrom(Class<Object> type,
Type genericType,
Annotation[] annotations,
MediaType mediaType,
MultivaluedMap<String,String> httpHeaders,
InputStream entityStream)
Method that JAX-RS container calls to deserialize given value.
|
void |
writeTo(Object value,
Class<?> type,
Type genericType,
Annotation[] annotations,
MediaType mediaType,
MultivaluedMap<String,Object> httpHeaders,
OutputStream entityStream)
Method that JAX-RS container calls to serialize given value.
|
_configForReading, _configForWriting, _locateMapperViaProvider, hasMatchingMediaType, isJsonType, setJSONPFunctionName, version
_addSuperTypes, _configForReading, _configForWriting, _containedIn, _createGenerator, _createNoContentException, _createParser, _endpointForReading, _endpointForWriting, _findCustomUntouchable, _isIgnorableForReading, _isIgnorableForWriting, _isSpecialReadable, _modifyHeaders, addUntouchable, checkCanDeserialize, checkCanSerialize, configure, configure, configure, configure, configure, disable, disable, disable, disable, disable, disable, enable, enable, enable, enable, enable, enable, findEncoding, findSuperTypes, findSuperTypes, getSize, hasMatchingMediaTypeForReading, hasMatchingMediaTypeForWriting, isEnabled, locateMapper, removeUntouchable, setAnnotationsToUse, setDefaultReadView, setDefaultView, setDefaultWriteView, setMapper
protected final ConcurrentHashMap<org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider.ClassAnnotationKey,JsonEndpointConfig> _readers
protected final ConcurrentHashMap<org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider.ClassAnnotationKey,JsonEndpointConfig> _writers
public boolean isReadable(Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType)
ProviderBase
ProviderBase.hasMatchingMediaType(javax.ws.rs.core.MediaType)
);
then verify
that type is not one of "untouchable" types (types we will never
automatically handle), and finally that there is a deserializer
for type (iff ProviderBase.checkCanDeserialize(boolean)
has been called with
true argument -- otherwise assumption is there will be a handler)isReadable
in interface MessageBodyReader<Object>
isReadable
in class ProviderBase<JacksonJsonProvider,ObjectMapper,JsonEndpointConfig,JsonMapperConfigurator>
aClass
- the class of instance to be produced.type
- the type of instance to be produced. E.g. if the
message body is to be converted into a method parameter, this will be
the formal type of the method parameter as returned by
Method.getGenericParameterTypes
.annotations
- an array of the annotations on the declaration of the
artifact that will be initialized with the produced instance. E.g. if the
message body is to be converted into a method parameter, this will be
the annotations on that parameter returned by
Method.getParameterAnnotations
.mediaType
- the media type of the HTTP entity, if one is not
specified in the request then application/octet-stream
is
used.true
if the type is supported, otherwise false
.public boolean isWriteable(Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType)
ProviderBase
ProviderBase.hasMatchingMediaType(javax.ws.rs.core.MediaType)
); then verify
that type is not one of "untouchable" types (types we will never
automatically handle), and finally that there is a serializer
for type (iff ProviderBase.checkCanSerialize(boolean)
has been called with
true argument -- otherwise assumption is there will be a handler)isWriteable
in interface MessageBodyWriter<Object>
isWriteable
in class ProviderBase<JacksonJsonProvider,ObjectMapper,JsonEndpointConfig,JsonMapperConfigurator>
aClass
- the class of instance that is to be written.type
- the type of instance to be written, obtained either
by reflection of a resource method return type or via inspection
of the returned instance. GenericEntity
provides a way to specify this information at runtime.annotations
- an array of the annotations attached to the message entity instance.mediaType
- the media type of the HTTP entity.true
if the type is supported, otherwise false
.public Object readFrom(Class<Object> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String,String> httpHeaders, InputStream entityStream) throws IOException
ProviderBase
readFrom
in interface MessageBodyReader<Object>
readFrom
in class ProviderBase<JacksonJsonProvider,ObjectMapper,JsonEndpointConfig,JsonMapperConfigurator>
type
- the type that is to be read from the entity stream.genericType
- the type of instance to be produced. E.g. if the
message body is to be converted into a method parameter, this will be
the formal type of the method parameter as returned by
Method.getGenericParameterTypes
.annotations
- an array of the annotations on the declaration of the
artifact that will be initialized with the produced instance. E.g.
if the message body is to be converted into a method parameter, this
will be the annotations on that parameter returned by
Method.getParameterAnnotations
.mediaType
- the media type of the HTTP entity.httpHeaders
- the read-only HTTP headers associated with HTTP entity.entityStream
- the InputStream
of the HTTP entity. The
caller is responsible for ensuring that the input stream ends when the
entity has been consumed. The implementation should not close the input
stream.NoContentException
in case no zero-length entity representation is
defined for the supported Java type.IOException
- if an IO error arises. In case the entity input stream is empty
and the reader is not able to produce a Java representation for
a zero-length entity, NoContentException
is expected to
be thrown.public void writeTo(Object value, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String,Object> httpHeaders, OutputStream entityStream) throws IOException
ProviderBase
writeTo
in interface MessageBodyWriter<Object>
writeTo
in class ProviderBase<JacksonJsonProvider,ObjectMapper,JsonEndpointConfig,JsonMapperConfigurator>
value
- the instance to write.type
- the class of instance that is to be written.genericType
- the type of instance to be written. GenericEntity
provides a way to specify this information at runtime.annotations
- an array of the annotations attached to the message entity instance.mediaType
- the media type of the HTTP entity.httpHeaders
- a mutable map of the HTTP message headers.entityStream
- the OutputStream
for the HTTP entity. The
implementation should not close the output stream.IOException
- if an IO error arises.Copyright © 2019 JBoss by Red Hat. All rights reserved.