Class PluginJacksonMessageBodyReader

  • All Implemented Interfaces:
    javax.ws.rs.ext.MessageBodyReader<Object>

    public abstract class PluginJacksonMessageBodyReader
    extends Object
    implements javax.ws.rs.ext.MessageBodyReader<Object>
    Message body reader that can be reused across plugins.

    As it turns out, Jersey has a hard time when more than one message body reader can read the same input. This class will allow any installed plugin’s message body reader to deserialize any plugin’s VO classes.

    • Constructor Detail

      • PluginJacksonMessageBodyReader

        protected PluginJacksonMessageBodyReader​(String packagePrefix)
        Sets the package prefix
        Parameters:
        packagePrefix - The package prefix for your implementation
    • Method Detail

      • isReadable

        public boolean isReadable​(Class<?> type,
                                  Type genericType,
                                  Annotation[] annotations,
                                  javax.ws.rs.core.MediaType mediaType)
        Determines whether the input is readable
        Specified by:
        isReadable in interface javax.ws.rs.ext.MessageBodyReader<Object>
        See Also:
        MessageBodyReader.isReadable(Class, Type, Annotation[], MediaType)
      • readFrom

        public Object readFrom​(Class<Object> type,
                               Type genericType,
                               Annotation[] annotations,
                               javax.ws.rs.core.MediaType mediaType,
                               javax.ws.rs.core.MultivaluedMap<String,​String> httpHeaders,
                               InputStream entityStream)
                        throws IOException,
                               javax.ws.rs.WebApplicationException
        Reads the input in the context of the requested type’s classloader
        Specified by:
        readFrom in interface javax.ws.rs.ext.MessageBodyReader<Object>
        Throws:
        IOException
        javax.ws.rs.WebApplicationException
        See Also:
        MessageBodyReader.readFrom(Class, Type, Annotation[], MediaType, MultivaluedMap, InputStream)