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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanisReadable(Class<?> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType) protected booleanisSupportedMediaType(jakarta.ws.rs.core.MediaType mediaType) booleanisWriteable(Class<?> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType) readFrom(Class<Object> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType, jakarta.ws.rs.core.MultivaluedMap<String, String> httpHeaders, InputStream entityStream) voidwriteTo(Object t, Class<?> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType, jakarta.ws.rs.core.MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jakarta.ws.rs.ext.MessageBodyWriter
getSize
-
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:
isWriteablein interfacejakarta.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:
writeToin interfacejakarta.ws.rs.ext.MessageBodyWriter<Object>- Throws:
IOExceptionjakarta.ws.rs.WebApplicationException
-
isReadable
public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType) - Specified by:
isReadablein interfacejakarta.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:
readFromin interfacejakarta.ws.rs.ext.MessageBodyReader<Object>- Throws:
IOExceptionjakarta.ws.rs.WebApplicationException
-
isSupportedMediaType
protected boolean isSupportedMediaType(jakarta.ws.rs.core.MediaType mediaType)
-