Class JsrJsonbProvider

java.lang.Object
org.apache.cxf.jaxrs.provider.jsrjsonb.JsrJsonbProvider
All Implemented Interfaces:
jakarta.ws.rs.ext.MessageBodyReader<Object>, jakarta.ws.rs.ext.MessageBodyWriter<Object>

@Produces({"application/json","text/json","application/*+json"}) @Consumes({"application/json","text/json","application/*+json"}) @Provider public class JsrJsonbProvider extends Object implements jakarta.ws.rs.ext.MessageBodyReader<Object>, jakarta.ws.rs.ext.MessageBodyWriter<Object>
11.2.7 Java API for JSON Binding (JSR-370) In a product that supports the Java API for JSON Binding (JSON-B) [19], implementations MUST support entity providers for all Java types supported by JSON-B in combination with the following media types: application/json, text/json as well as any other media types matching "*"/json or "*"/"*"+json". Note that if JSON-B and JSON-P are both supported in the same environment, entity providers for JSON-B take precedence over those for JSON-P for all types except JsonValue and its sub-types.
  • Constructor Details

    • JsrJsonbProvider

      public JsrJsonbProvider()
    • JsrJsonbProvider

      public JsrJsonbProvider(jakarta.json.bind.Jsonb jsonb)
  • Method Details

    • 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>
    • writeTo

      public void writeTo(Object t, 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
    • 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
    • isSupportedMediaType

      protected boolean isSupportedMediaType(jakarta.ws.rs.core.MediaType mediaType)