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 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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlonggetSize(JsonStructure jsonStructure, Class<?> aClass, Type type, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType) private voidinit()booleanisWriteable(Class<?> aClass, Type type, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType) private static booleansupportsMediaType(javax.ws.rs.core.MediaType mediaType) voidwriteTo(JsonStructure jsonStructure, Class<?> aClass, Type type, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<String, Object> stringObjectMultivaluedMap, OutputStream outputStream)
-
Field Details
-
JSON
- See Also:
-
PLUS_JSON
- See Also:
-
wf
-
-
Constructor Details
-
JsonStructureBodyWriter
public JsonStructureBodyWriter()
-
-
Method Details
-
init
-
isWriteable
public boolean isWriteable(Class<?> aClass, Type type, 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, Class<?> aClass, Type type, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType) - Specified by:
getSizein interfacejavax.ws.rs.ext.MessageBodyWriter<JsonStructure>
-
writeTo
public void writeTo(JsonStructure jsonStructure, Class<?> aClass, Type type, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<String, Object> stringObjectMultivaluedMap, OutputStream outputStream) throws IOException, javax.ws.rs.WebApplicationException- Specified by:
writeToin interfacejavax.ws.rs.ext.MessageBodyWriter<JsonStructure>- Throws:
IOExceptionjavax.ws.rs.WebApplicationException
-