Class JsonIdAdderBodyReader

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

    @Provider
    @Consumes("application/json")
    public class JsonIdAdderBodyReader
    extends Object
    implements javax.ws.rs.ext.MessageBodyReader<Object>
    Sometimes resteasy will not unmarshal an json because there is no type information, but the prototype actually specifies it fully. The message body reader will deal with that, by adding the id implicetely (if it is missing) before the actual unmarshal.
    Since:
    2.7
    Author:
    Michiel Meeuwissen
    • Constructor Detail

      • JsonIdAdderBodyReader

        public JsonIdAdderBodyReader()
    • Method Detail

      • isReadable

        public boolean isReadable​(Class<?> type,
                                  Type genericType,
                                  Annotation[] annotations,
                                  javax.ws.rs.core.MediaType mediaType)
        Specified by:
        isReadable in interface javax.ws.rs.ext.MessageBodyReader<Object>
      • 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 javax.ws.rs.WebApplicationException,
                               IOException
        Specified by:
        readFrom in interface javax.ws.rs.ext.MessageBodyReader<Object>
        Throws:
        javax.ws.rs.WebApplicationException
        IOException