Class JSONObjectMarshaller

  • All Implemented Interfaces:
    javax.ws.rs.ext.MessageBodyWriter<org.apache.jena.atlas.json.JsonValue>

    @Provider
    @Produces("application/json")
    public class JSONObjectMarshaller
    extends Object
    implements javax.ws.rs.ext.MessageBodyWriter<org.apache.jena.atlas.json.JsonValue>
    The default Jersey Marshaller doesn't seem to get registered so provide our own. Since we are doing that anyway then using the Atlas JSON implementation.
    Author:
    Dave Reynolds
    • Constructor Detail

      • JSONObjectMarshaller

        public JSONObjectMarshaller()
    • Method Detail

      • getSize

        public long getSize​(org.apache.jena.atlas.json.JsonValue result,
                            Class<?> type,
                            Type genericType,
                            Annotation[] annotations,
                            javax.ws.rs.core.MediaType mediaType)
        Specified by:
        getSize in interface javax.ws.rs.ext.MessageBodyWriter<org.apache.jena.atlas.json.JsonValue>
      • isWriteable

        public boolean isWriteable​(Class<?> type,
                                   Type genericType,
                                   Annotation[] annotations,
                                   javax.ws.rs.core.MediaType mediaType)
        Specified by:
        isWriteable in interface javax.ws.rs.ext.MessageBodyWriter<org.apache.jena.atlas.json.JsonValue>
      • writeTo

        public void writeTo​(org.apache.jena.atlas.json.JsonValue value,
                            Class<?> doNotUse,
                            Type genericType,
                            Annotation[] annotations,
                            javax.ws.rs.core.MediaType mediaType,
                            javax.ws.rs.core.MultivaluedMap<String,​Object> httpHeaders,
                            OutputStream entityStream)
                     throws IOException,
                            javax.ws.rs.WebApplicationException
        Specified by:
        writeTo in interface javax.ws.rs.ext.MessageBodyWriter<org.apache.jena.atlas.json.JsonValue>
        Throws:
        IOException
        javax.ws.rs.WebApplicationException