Class 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.
    Author:
    Jitendra Kotamraju, Blaise Doughan, Michal Gajdos
    • Constructor Detail

      • JsonStructureBodyWriter

        public JsonStructureBodyWriter()
    • Method Detail

      • 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<JsonStructure>
      • getSize

        public long getSize​(JsonStructure jsonStructure,
                            Class<?> aClass,
                            Type type,
                            Annotation[] annotations,
                            javax.ws.rs.core.MediaType mediaType)
        Specified by:
        getSize in interface javax.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 interface javax.ws.rs.ext.MessageBodyWriter<JsonStructure>
        Throws:
        IOException
        javax.ws.rs.WebApplicationException