EclipseLink 2.4.2, build 'v20130514-5956486' 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)
           
static javax.ws.rs.core.MediaType getResponseMediaType(javax.ws.rs.core.HttpHeaders headers)
           
static javax.ws.rs.core.MediaType mediaType(java.util.List<javax.ws.rs.core.MediaType> 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,
                  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<javax.ws.rs.core.MediaType> types)
Identify the preferred MediaType from the list provided. This will check for JSON string or MediaType first then XML.

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

createMarshaller

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

getResponseMediaType

public static javax.ws.rs.core.MediaType getResponseMediaType(javax.ws.rs.core.HttpHeaders headers)

EclipseLink 2.4.2, build 'v20130514-5956486' API Reference