EclipseLink 2.5.0, build 'v20130110-d839ca4' 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

Field Summary
static java.lang.String NO_ROUTE_JAXB_ELEMENT_LABEL
           
 
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 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
 

Field Detail

NO_ROUTE_JAXB_ELEMENT_LABEL

public static final java.lang.String NO_ROUTE_JAXB_ELEMENT_LABEL
See Also:
Constant Field Values
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
Specified by:
write in interface javax.ws.rs.core.StreamingOutput
Throws:
java.io.IOException

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 Marshaller createMarshaller(PersistenceContext context,
                                          javax.ws.rs.core.MediaType mediaType)
                                   throws JAXBException
Throws:
JAXBException

EclipseLink 2.5.0, build 'v20130110-d839ca4' API Reference