org.overlord.sramp.atom.providers
Class HttpResponseProvider

java.lang.Object
  extended by org.overlord.sramp.atom.providers.HttpResponseProvider
All Implemented Interfaces:
javax.ws.rs.ext.MessageBodyReader<HttpResponseBean>, javax.ws.rs.ext.MessageBodyWriter<HttpResponseBean>

@Provider
public class HttpResponseProvider
extends Object
implements javax.ws.rs.ext.MessageBodyReader<HttpResponseBean>, javax.ws.rs.ext.MessageBodyWriter<HttpResponseBean>

A RESTEasy provider for reading/writing an HTTP Response. This is used in the batch processing support in s-ramp. In the batch operations, the return value is always a multipart/related HTTP response, made up of a list of individual HTTP responses (one for each entry in the batch).

Author:
eric.wittmann@redhat.com

Field Summary
protected  javax.ws.rs.ext.Providers providers
           
 
Constructor Summary
HttpResponseProvider()
          Constructor.
 
Method Summary
 long getSize(HttpResponseBean t, Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)
           
 boolean isReadable(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)
           
 HttpResponseBean readFrom(Class<HttpResponseBean> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<String,String> httpHeaders, InputStream entityStream)
           
 void writeTo(HttpResponseBean 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
 

Field Detail

providers

@Context
protected javax.ws.rs.ext.Providers providers
Constructor Detail

HttpResponseProvider

public HttpResponseProvider()
Constructor.

Method Detail

isReadable

public boolean isReadable(Class<?> type,
                          Type genericType,
                          Annotation[] annotations,
                          javax.ws.rs.core.MediaType mediaType)
Specified by:
isReadable in interface javax.ws.rs.ext.MessageBodyReader<HttpResponseBean>
See Also:
MessageBodyReader.isReadable(java.lang.Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType)

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<HttpResponseBean>
See Also:
MessageBodyWriter.isWriteable(java.lang.Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType)

getSize

public long getSize(HttpResponseBean t,
                    Class<?> type,
                    Type genericType,
                    Annotation[] annotations,
                    javax.ws.rs.core.MediaType mediaType)
Specified by:
getSize in interface javax.ws.rs.ext.MessageBodyWriter<HttpResponseBean>
See Also:
MessageBodyWriter.getSize(java.lang.Object, java.lang.Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType)

writeTo

public void writeTo(HttpResponseBean 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<HttpResponseBean>
Throws:
IOException
javax.ws.rs.WebApplicationException
See Also:
MessageBodyWriter.writeTo(java.lang.Object, java.lang.Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType, javax.ws.rs.core.MultivaluedMap, java.io.OutputStream)

readFrom

public HttpResponseBean readFrom(Class<HttpResponseBean> type,
                                 Type genericType,
                                 Annotation[] annotations,
                                 javax.ws.rs.core.MediaType mediaType,
                                 javax.ws.rs.core.MultivaluedMap<String,String> httpHeaders,
                                 InputStream entityStream)
                          throws IOException,
                                 javax.ws.rs.WebApplicationException
Specified by:
readFrom in interface javax.ws.rs.ext.MessageBodyReader<HttpResponseBean>
Throws:
IOException
javax.ws.rs.WebApplicationException
See Also:
MessageBodyReader.readFrom(java.lang.Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType, javax.ws.rs.core.MultivaluedMap, java.io.InputStream)


Copyright © 2011-2013 JBoss, a division of Red Hat. All Rights Reserved.