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 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 TypeMethodDescriptionlong
getSize
(JsonStructure jsonStructure, Class<?> aClass, Type type, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType) private void
init()
boolean
isWriteable
(Class<?> aClass, Type type, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType) private static boolean
supportsMediaType
(javax.ws.rs.core.MediaType mediaType) 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)
-
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:
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, Class<?> aClass, Type type, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType) - Specified by:
getSize
in 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:
writeTo
in interfacejavax.ws.rs.ext.MessageBodyWriter<JsonStructure>
- Throws:
IOException
javax.ws.rs.WebApplicationException
-