Package org.glassfish.json.jaxrs
Class JsonStructureBodyWriter
- java.lang.Object
-
- org.glassfish.json.jaxrs.JsonStructureBodyWriter
-
- All Implemented Interfaces:
javax.ws.rs.ext.MessageBodyWriter<JsonStructure>
@Provider @Produces({"application/json","text/json","*/*"}) public class JsonStructureBodyWriter extends java.lang.Object implements javax.ws.rs.ext.MessageBodyWriter<JsonStructure>
JAX-RS MessageBodyWriter for JsonStructure. This allows JsonStructure, JsonArray and JsonObject 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 JsonStructureBodyWriter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getSize(JsonStructure jsonStructure, 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(JsonStructure jsonStructure, 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<JsonStructure>
-
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(JsonStructure jsonStructure, 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<JsonStructure>
-
writeTo
public void writeTo(JsonStructure jsonStructure, 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<JsonStructure>
- Throws:
java.io.IOException
javax.ws.rs.WebApplicationException
-
-