Class ResteasyJackson2Provider

    • Field Detail

      • decorators

        protected final ConcurrentHashMap<org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider.ClassAnnotationKey,​Boolean> decorators
    • Constructor Detail

      • ResteasyJackson2Provider

        public ResteasyJackson2Provider()
    • Method Detail

      • isReadable

        public boolean isReadable​(Class<?> aClass,
                                  Type type,
                                  Annotation[] annotations,
                                  MediaType mediaType)
        Description copied from class: ProviderBase
        Method that Jakarta-RS container calls to try to check whether values of given type (and media type) can be deserialized by this provider. Implementation will first check that expected media type is a JSON type (via call to ProviderBase.hasMatchingMediaType(jakarta.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)
        Specified by:
        isReadable in interface MessageBodyReader<Object>
        Overrides:
        isReadable in class ProviderBase<JacksonJsonProvider,​ObjectMapper,​JsonEndpointConfig,​JsonMapperConfigurator>
        Parameters:
        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.
        Returns:
        true if the type is supported, otherwise false.
      • readFrom

        public Object readFrom​(Class<Object> type,
                               Type genericType,
                               Annotation[] annotations,
                               MediaType mediaType,
                               MultivaluedMap<String,​String> httpHeaders,
                               InputStream entityStream)
                        throws IOException
        Description copied from class: ProviderBase
        Method that Jakarta-RS container calls to deserialize given value.
        Specified by:
        readFrom in interface MessageBodyReader<Object>
        Overrides:
        readFrom in class ProviderBase<JacksonJsonProvider,​ObjectMapper,​JsonEndpointConfig,​JsonMapperConfigurator>
        Parameters:
        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.
        Returns:
        the type that was read from the stream. In case the entity input stream is empty, the reader is expected to either return an instance representing a zero-length entity or throw a NoContentException in case no zero-length entity representation is defined for the supported Java type.
        Throws:
        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.