public class StreamingOutputMarshaller
extends java.lang.Object
implements javax.ws.rs.core.StreamingOutput
StreamingOutput implementation that uses the provided
JAXBContext to marshal the result when requested to either XML or
JSON based on the accept media provided.| Constructor and 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) |
| Modifier and Type | Method and 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 preferred
MediaType from the list provided. |
void |
write(java.io.OutputStream output) |
public StreamingOutputMarshaller(PersistenceContext context, java.lang.Object result, javax.ws.rs.core.MediaType acceptedType)
public StreamingOutputMarshaller(PersistenceContext context, java.lang.Object result, java.util.List<javax.ws.rs.core.MediaType> acceptedTypes, FieldsFilter filter)
context - persistence context.result - entity to process.acceptedTypes - accepted media types.filter - containing a list of fields to filter out from the response.public StreamingOutputMarshaller(PersistenceContext context, java.lang.Object result, java.util.List<javax.ws.rs.core.MediaType> acceptedTypes)
context - persistence context.result - entity to process.acceptedTypes - accepted media types.public void write(java.io.OutputStream output)
throws java.io.IOException,
javax.ws.rs.WebApplicationException
write in interface javax.ws.rs.core.StreamingOutputjava.io.IOExceptionjavax.ws.rs.WebApplicationExceptionpublic static javax.ws.rs.core.MediaType mediaType(java.util.List<javax.ws.rs.core.MediaType> types)
MediaType from the list provided. This
will check for JSON string or MediaType first then XML.types - List of MediaType values;MediaTypepublic static Marshaller createMarshaller(PersistenceContext context, javax.ws.rs.core.MediaType mediaType) throws JAXBException
JAXBExceptionpublic static javax.ws.rs.core.MediaType getResponseMediaType(javax.ws.rs.core.HttpHeaders headers)