Class StreamingOutputMarshaller
java.lang.Object
org.eclipse.persistence.jpa.rs.util.StreamingOutputMarshaller
- All Implemented Interfaces:
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.- Since:
- EclipseLink 2.4.0
-
Constructor Summary
ConstructorDescriptionStreamingOutputMarshaller
(PersistenceContext context, Object result, MediaType acceptedType) StreamingOutputMarshaller
(PersistenceContext context, Object result, List<MediaType> acceptedTypes) Creates a new StreamingOutputMarshaller.StreamingOutputMarshaller
(PersistenceContext context, Object result, List<MediaType> acceptedTypes, FieldsFilter filter) This constructor is used for fields filtering. -
Method Summary
Modifier and TypeMethodDescriptionstatic Marshaller
createMarshaller
(PersistenceContext context, MediaType mediaType) static MediaType
getResponseMediaType
(HttpHeaders headers) static MediaType
Identify the preferredMediaType
from the list provided.void
write
(OutputStream output)
-
Constructor Details
-
StreamingOutputMarshaller
-
StreamingOutputMarshaller
public StreamingOutputMarshaller(PersistenceContext context, Object result, List<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, Object result, List<MediaType> acceptedTypes) Creates a new StreamingOutputMarshaller.- Parameters:
context
- persistence context.result
- entity to process.acceptedTypes
- accepted media types.
-
-
Method Details
-
write
- Specified by:
write
in interfaceStreamingOutput
- Throws:
IOException
WebApplicationException
-
mediaType
-
createMarshaller
public static Marshaller createMarshaller(PersistenceContext context, MediaType mediaType) throws JAXBException - Throws:
JAXBException
-
getResponseMediaType
-