Package nl.vpro.jackson2.rs
Class JsonIdAdderBodyReader
- java.lang.Object
-
- nl.vpro.jackson2.rs.JsonIdAdderBodyReader
-
- All Implemented Interfaces:
javax.ws.rs.ext.MessageBodyReader<Object>
@Provider @Consumes("application/json") @Priority(4999) public class JsonIdAdderBodyReader extends Object implements javax.ws.rs.ext.MessageBodyReader<Object>Sometimes jackson/resteasy will not unmarshal a json because there is no type information, but the prototype actually specifies it fully. This message body reader will deal with that (usingTypeIdResolver.idFromBaseType(), by adding the id implicitly (if it is missing) before the actual unmarshal.- Since:
- 2.7
- Author:
- Michiel Meeuwissen
-
-
Constructor Summary
Constructors Constructor Description JsonIdAdderBodyReader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisReadable(Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)ObjectreadFrom(@NonNull Class<Object> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<String,String> httpHeaders, InputStream entityStream)
-
-
-
Method Detail
-
isReadable
public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)
- Specified by:
isReadablein interfacejavax.ws.rs.ext.MessageBodyReader<Object>
-
readFrom
public Object readFrom(@NonNull 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:
readFromin interfacejavax.ws.rs.ext.MessageBodyReader<Object>- Throws:
javax.ws.rs.WebApplicationExceptionIOException
-
-