java.lang.Object
org.eclipse.parsson.media.JsonValueBodyWriter
- All Implemented Interfaces:
jakarta.ws.rs.ext.MessageBodyWriter<jakarta.json.JsonValue>
@Provider
@Produces({"application/json","text/json","*/*"})
public class JsonValueBodyWriter
extends Object
implements jakarta.ws.rs.ext.MessageBodyWriter<jakarta.json.JsonValue>
Jakarta RESTful Web Services MessageBodyWriter for JsonValue.
This allows JsonValue to be return type of a resource method.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlong
getSize
(jakarta.json.JsonValue jsonValue, Class<?> aClass, Type type, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType) void
init()
boolean
isWriteable
(Class<?> aClass, Type type, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType) private static boolean
supportsMediaType
(jakarta.ws.rs.core.MediaType mediaType) void
writeTo
(jakarta.json.JsonValue jsonValue, Class<?> aClass, Type type, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType, jakarta.ws.rs.core.MultivaluedMap<String, Object> stringObjectMultivaluedMap, OutputStream outputStream)
-
Field Details
-
JSON
- See Also:
-
PLUS_JSON
- See Also:
-
wf
private jakarta.json.JsonWriterFactory wf -
config
private final jakarta.ws.rs.core.Configuration config
-
-
Constructor Details
-
JsonValueBodyWriter
public JsonValueBodyWriter(@Context jakarta.ws.rs.core.Configuration config) Constructor.- Parameters:
config
- configuration
-
-
Method Details
-
init
@PostConstruct public void init() -
isWriteable
public boolean isWriteable(Class<?> aClass, Type type, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType) - Specified by:
isWriteable
in interfacejakarta.ws.rs.ext.MessageBodyWriter<jakarta.json.JsonValue>
-
supportsMediaType
private static boolean supportsMediaType(jakarta.ws.rs.core.MediaType mediaType) - Returns:
- true for all media types of the pattern */json and */*+json.
-
getSize
public long getSize(jakarta.json.JsonValue jsonValue, Class<?> aClass, Type type, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType) - Specified by:
getSize
in interfacejakarta.ws.rs.ext.MessageBodyWriter<jakarta.json.JsonValue>
-
writeTo
public void writeTo(jakarta.json.JsonValue jsonValue, Class<?> aClass, Type type, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType, jakarta.ws.rs.core.MultivaluedMap<String, Object> stringObjectMultivaluedMap, OutputStream outputStream) throws IOException, jakarta.ws.rs.WebApplicationException- Specified by:
writeTo
in interfacejakarta.ws.rs.ext.MessageBodyWriter<jakarta.json.JsonValue>
- Throws:
IOException
jakarta.ws.rs.WebApplicationException
-