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 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 Details

  • Constructor Details

    • JsonValueBodyWriter

      public JsonValueBodyWriter()
  • Method Details

    • init

      @PostConstruct private void init()
    • isWriteable

      public boolean isWriteable(Class<?> aClass, Type type, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)
      Specified by:
      isWriteable in interface javax.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, Class<?> aClass, Type type, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)
      Specified by:
      getSize in interface javax.ws.rs.ext.MessageBodyWriter<JsonValue>
    • writeTo

      public void writeTo(JsonValue jsonValue, 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 interface javax.ws.rs.ext.MessageBodyWriter<JsonValue>
      Throws:
      IOException
      javax.ws.rs.WebApplicationException