Class StreamingOutputMarshaller
- java.lang.Object
-
- 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
SimpleStreamingOutput
implementation that uses the providedJAXBContext
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
Constructors Constructor Description StreamingOutputMarshaller(PersistenceContext context, java.lang.Object result, java.util.List<javax.ws.rs.core.MediaType> acceptedTypes)
Creates a new StreamingOutputMarshaller.StreamingOutputMarshaller(PersistenceContext context, java.lang.Object result, java.util.List<javax.ws.rs.core.MediaType> acceptedTypes, FieldsFilter filter)
This constructor is used for fields filtering.StreamingOutputMarshaller(PersistenceContext context, java.lang.Object result, javax.ws.rs.core.MediaType acceptedType)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 preferredMediaType
from the list provided.void
write(java.io.OutputStream output)
-
-
-
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, FieldsFilter filter)
This constructor is used for fields filtering. Only attributes included in fields parameter are marshalled.- Parameters:
context
- persistence context.result
- entity to process.acceptedTypes
- accepted media types.filter
- containing a list of fields to filter out from the response.
-
StreamingOutputMarshaller
public StreamingOutputMarshaller(PersistenceContext context, java.lang.Object result, java.util.List<javax.ws.rs.core.MediaType> acceptedTypes)
Creates a new StreamingOutputMarshaller.- Parameters:
context
- persistence context.result
- entity to process.acceptedTypes
- accepted media types.
-
-
Method Detail
-
write
public void write(java.io.OutputStream output) throws java.io.IOException, javax.ws.rs.WebApplicationException
- Specified by:
write
in interfacejavax.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 preferredMediaType
from the list provided. This will check for JSON string orMediaType
first then XML.- Parameters:
types
- List ofMediaType
values;- Returns:
- selected
MediaType
-
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)
-
-