fr.opensagres.xdocreport.remoting.resources.services.jaxrs
Class LargeBinaryDataMessageBodyWriter

java.lang.Object
  extended by fr.opensagres.xdocreport.remoting.resources.services.jaxrs.LargeBinaryDataMessageBodyWriter
All Implemented Interfaces:
javax.ws.rs.ext.MessageBodyWriter<LargeBinaryData>

@Provider
public class LargeBinaryDataMessageBodyWriter
extends Object
implements javax.ws.rs.ext.MessageBodyWriter<LargeBinaryData>

MessageBodyWriter that streams an BinaryData object in an Http response.

To allow streaming the binday data is directly sent inside the Http body and the other attributes are passed as http header (it avoids to use MultiPart encoding)

Author:
Tiry

Constructor Summary
LargeBinaryDataMessageBodyWriter()
           
 
Method Summary
 long getSize(LargeBinaryData t, Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)
           
 boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)
           
 void writeTo(LargeBinaryData t, Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<String,Object> httpHeaders, OutputStream entityStream)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LargeBinaryDataMessageBodyWriter

public LargeBinaryDataMessageBodyWriter()
Method Detail

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

getSize

public long getSize(LargeBinaryData t,
                    Class<?> type,
                    Type genericType,
                    Annotation[] annotations,
                    javax.ws.rs.core.MediaType mediaType)
Specified by:
getSize in interface javax.ws.rs.ext.MessageBodyWriter<LargeBinaryData>

writeTo

public void writeTo(LargeBinaryData t,
                    Class<?> type,
                    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<LargeBinaryData>
Throws:
IOException
javax.ws.rs.WebApplicationException


Copyright © 2013. All rights reserved.