Package org.glassfish.json.jaxrs
Class JsonValueBodyWriter
- java.lang.Object
-
- org.glassfish.json.jaxrs.JsonValueBodyWriter
-
- All Implemented Interfaces:
javax.ws.rs.ext.MessageBodyWriter<JsonValue>
@Provider @Produces({"application/json","text/json","*/*"}) public class JsonValueBodyWriter extends java.lang.Object implements javax.ws.rs.ext.MessageBodyWriter<JsonValue>
JAX-RS MessageBodyWriter for JsonValue. This allows JsonValue to be return type of a resource method.
-
-
Field Summary
Fields Modifier and Type Field Description private javax.ws.rs.core.Configuration
config
private static java.lang.String
JSON
private static java.lang.String
PLUS_JSON
private JsonWriterFactory
wf
-
Constructor Summary
Constructors Constructor Description JsonValueBodyWriter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getSize(JsonValue jsonValue, java.lang.Class<?> aClass, java.lang.reflect.Type type, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)
private void
init()
boolean
isWriteable(java.lang.Class<?> aClass, java.lang.reflect.Type type, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)
private static boolean
supportsMediaType(javax.ws.rs.core.MediaType mediaType)
void
writeTo(JsonValue jsonValue, java.lang.Class<?> aClass, java.lang.reflect.Type type, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.Object> stringObjectMultivaluedMap, java.io.OutputStream outputStream)
-
-
-
Field Detail
-
JSON
private static final java.lang.String JSON
- See Also:
- Constant Field Values
-
PLUS_JSON
private static final java.lang.String PLUS_JSON
- See Also:
- Constant Field Values
-
wf
private JsonWriterFactory wf
-
config
@Context private javax.ws.rs.core.Configuration config
-
-
Method Detail
-
init
@PostConstruct private void init()
-
isWriteable
public boolean isWriteable(java.lang.Class<?> aClass, java.lang.reflect.Type type, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)
- Specified by:
isWriteable
in interfacejavax.ws.rs.ext.MessageBodyWriter<JsonValue>
-
supportsMediaType
private static boolean supportsMediaType(javax.ws.rs.core.MediaType mediaType)
- Returns:
- true for all media types of the pattern */json and */*+json.
-
getSize
public long getSize(JsonValue jsonValue, java.lang.Class<?> aClass, java.lang.reflect.Type type, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)
- Specified by:
getSize
in interfacejavax.ws.rs.ext.MessageBodyWriter<JsonValue>
-
writeTo
public void writeTo(JsonValue jsonValue, java.lang.Class<?> aClass, java.lang.reflect.Type type, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.Object> stringObjectMultivaluedMap, java.io.OutputStream outputStream) throws java.io.IOException, javax.ws.rs.WebApplicationException
- Specified by:
writeTo
in interfacejavax.ws.rs.ext.MessageBodyWriter<JsonValue>
- Throws:
java.io.IOException
javax.ws.rs.WebApplicationException
-
-