application/json via Gson so resources can return strongly-typed POJOs.
Skips primitive types (String, byte[], InputStream) so JAX-RS' built-in writers handle them.
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
Implements jakarta. Ascertain if the MessageBodyWriter supports a particular type. |
| public void | writeTo(Object o, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream)
Implements jakarta. Write a type to an HTTP message. |
| gson | back to summary |
|---|---|
| private Gson gson
| |
| GsonMessageBodyWriter | back to summary |
|---|---|
| public GsonMessageBodyWriter() | |
| isWriteable | back to summary |
|---|---|
| public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) Implements jakarta. Doc from jakarta. Ascertain if the MessageBodyWriter supports a particular type.
| |
| writeTo | back to summary |
|---|---|
| public void writeTo(Object o, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException Implements jakarta. Doc from jakarta. Write a type to an HTTP message. The message header map is mutable but any changes must be made before writing to the output stream since the headers will be flushed prior to writing the message body.
| |