EclipseLink JPA-RS 2.4.1, build 'v20121003-ad44345' API Reference

org.eclipse.persistence.jpa.rs.util
Class StreamingOutputMarshaller

java.lang.Object
  extended by org.eclipse.persistence.jpa.rs.util.StreamingOutputMarshaller
All Implemented Interfaces:
javax.ws.rs.core.StreamingOutput

public class StreamingOutputMarshaller
extends java.lang.Object
implements javax.ws.rs.core.StreamingOutput

Simple StreamingOutput implementation that uses the provided JAXBContext to marshal the result when requested to either XML or JSON based on the accept media provided.

Author:
dclarke
Since:
EclipseLink 2.4.0

Constructor Summary
StreamingOutputMarshaller(PersistenceContext context, java.lang.Object result, java.util.List<javax.ws.rs.core.MediaType> acceptedTypes)
           
StreamingOutputMarshaller(PersistenceContext context, java.lang.Object result, javax.ws.rs.core.MediaType acceptedType)
           
 
Method Summary
static javax.xml.bind.Marshaller createMarshaller(PersistenceContext context, javax.ws.rs.core.MediaType mediaType)
           
protected static boolean isCompatible(java.lang.Object type, javax.ws.rs.core.MediaType[] types)
           
static javax.ws.rs.core.MediaType mediaType(java.util.List<?> types)
          Identify the preferred MediaType from the list provided.
 void write(java.io.OutputStream output)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamingOutputMarshaller

public StreamingOutputMarshaller(PersistenceContext context,
                                 java.lang.Object result,
                                 javax.ws.rs.core.MediaType acceptedType)

StreamingOutputMarshaller

public StreamingOutputMarshaller(PersistenceContext context,
                                 java.lang.Object result,
                                 java.util.List<javax.ws.rs.core.MediaType> acceptedTypes)
Method Detail

write

public void write(java.io.OutputStream output)
           throws java.io.IOException,
                  javax.ws.rs.WebApplicationException
Specified by:
write in interface javax.ws.rs.core.StreamingOutput
Throws:
java.io.IOException
javax.ws.rs.WebApplicationException

mediaType

public static javax.ws.rs.core.MediaType mediaType(java.util.List<?> types)
Identify the preferred MediaType from the list provided. This will check for JSON string or MediaType first then XML.

Parameters:
types - List of String or MediaType values;
Returns:
selected MediaType
Throws:
javax.ws.rs.WebApplicationException - with Status.UNSUPPORTED_MEDIA_TYPE if neither the JSON or XML values are found.

isCompatible

protected static boolean isCompatible(java.lang.Object type,
                                      javax.ws.rs.core.MediaType[] types)

createMarshaller

public static javax.xml.bind.Marshaller createMarshaller(PersistenceContext context,
                                                         javax.ws.rs.core.MediaType mediaType)
                                                  throws javax.xml.bind.JAXBException
Throws:
javax.xml.bind.JAXBException

EclipseLink JPA-RS 2.4.1, build 'v20121003-ad44345' API Reference