Package org.glassfish.json.jaxrs1x
Class JsonStructureBodyWriter
- java.lang.Object
-
- org.glassfish.json.jaxrs1x.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 static java.lang.StringJSONprivate static java.lang.StringPLUS_JSONprivate JsonWriterFactorywf
-
Constructor Summary
Constructors Constructor Description JsonStructureBodyWriter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetSize(JsonStructure jsonStructure, java.lang.Class<?> aClass, java.lang.reflect.Type type, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)private voidinit()booleanisWriteable(java.lang.Class<?> aClass, java.lang.reflect.Type type, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)private static booleansupportsMediaType(javax.ws.rs.core.MediaType mediaType)voidwriteTo(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
-
-
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:
isWriteablein 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:
getSizein 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:
writeToin interfacejavax.ws.rs.ext.MessageBodyWriter<JsonStructure>- Throws:
java.io.IOExceptionjavax.ws.rs.WebApplicationException
-
-