Class JacksonJsonMessageBodyReaderWriter

java.lang.Object
com.xebialabs.deployit.core.rest.json.JacksonJsonMessageBodyReaderWriter
All Implemented Interfaces:
jakarta.ws.rs.ext.MessageBodyReader<Object>, jakarta.ws.rs.ext.MessageBodyWriter<Object>

@Component @Provider @Priority(2147483647) @Consumes("application/json") @Produces("application/json") public class JacksonJsonMessageBodyReaderWriter extends Object implements jakarta.ws.rs.ext.MessageBodyReader<Object>, jakarta.ws.rs.ext.MessageBodyWriter<Object>
Generic JAX-RS JSON provider using Jackson 3. Acts as a fallback MessageBodyWriter/Reader for types that don't have a dedicated provider, replacing the removed resteasy-jackson-provider. This must be an in-project class because the PluginClassLoader cannot load classes from external jars like jackson-jakarta-rs-json-provider. Priority(Integer.MAX_VALUE) ensures it is the last resort after all specific providers.
  • Constructor Details

    • JacksonJsonMessageBodyReaderWriter

      public JacksonJsonMessageBodyReaderWriter()
  • Method Details

    • isReadable

      public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType)
      Specified by:
      isReadable in interface jakarta.ws.rs.ext.MessageBodyReader<Object>
    • readFrom

      public Object readFrom(Class<Object> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType, jakarta.ws.rs.core.MultivaluedMap<String,String> httpHeaders, InputStream entityStream) throws IOException, jakarta.ws.rs.WebApplicationException
      Specified by:
      readFrom in interface jakarta.ws.rs.ext.MessageBodyReader<Object>
      Throws:
      IOException
      jakarta.ws.rs.WebApplicationException
    • isWriteable

      public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType)
      Specified by:
      isWriteable in interface jakarta.ws.rs.ext.MessageBodyWriter<Object>
    • getSize

      public long getSize(Object obj, Class<?> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType)
      Specified by:
      getSize in interface jakarta.ws.rs.ext.MessageBodyWriter<Object>
    • writeTo

      public void writeTo(Object obj, Class<?> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType, jakarta.ws.rs.core.MultivaluedMap<String,Object> httpHeaders, OutputStream entityStream) throws IOException, jakarta.ws.rs.WebApplicationException
      Specified by:
      writeTo in interface jakarta.ws.rs.ext.MessageBodyWriter<Object>
      Throws:
      IOException
      jakarta.ws.rs.WebApplicationException