org.apache.clerezza.triaxrs.providers.provided
Class JafMessageBodyWriter<T>

java.lang.Object
  extended by org.apache.clerezza.triaxrs.providers.provided.JafMessageBodyWriter<T>
All Implemented Interfaces:
javax.ws.rs.ext.MessageBodyWriter<T>

public class JafMessageBodyWriter<T>
extends Object
implements javax.ws.rs.ext.MessageBodyWriter<T>

This class wraps the Java Activation Framework functionality, so it can be use as MessageBodyWriter. The function isWriteable() is not supported, because this provider can not be provided through the ProvidersImpl class and therefore the function is not needed.

Author:
mir

Constructor Summary
JafMessageBodyWriter(T entity, javax.ws.rs.core.MediaType mediaType)
          Creates a JAFMessageBodyWriter that writes entities of the type T/MediaType into Request Header.
 
Method Summary
 long getSize(T 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(T 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

JafMessageBodyWriter

public JafMessageBodyWriter(T entity,
                            javax.ws.rs.core.MediaType mediaType)
                     throws IOException,
                            UnsupportedDataTypeException
Creates a JAFMessageBodyWriter that writes entities of the type T/MediaType into Request Header. The entity parameter of this constructor and the entity you provide to the writeTo()-function don't have to be the same.

Parameters:
entity - Object of the type of object you want to convert
mediaType -
Throws:
IOException
UnsupportedDataTypeException
Method Detail

getSize

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

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

writeTo

public void writeTo(T 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<T>
Throws:
IOException
javax.ws.rs.WebApplicationException


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.