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.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NO_ROUTE_JAXB_ELEMENT_LABEL |
Constructor and Description |
---|
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) |
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 static final java.lang.String NO_ROUTE_JAXB_ELEMENT_LABEL
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)
public void write(java.io.OutputStream output) throws java.io.IOException, javax.ws.rs.WebApplicationException
write
in interface javax.ws.rs.core.StreamingOutput
java.io.IOException
javax.ws.rs.WebApplicationException
public 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;MediaType
javax.ws.rs.WebApplicationException
- with Status.UNSUPPORTED_MEDIA_TYPE if neither the JSON, XML
or OCTET_STREAM values are found.public static Marshaller createMarshaller(PersistenceContext context, javax.ws.rs.core.MediaType mediaType) throws JAXBException
JAXBException
public static javax.ws.rs.core.MediaType getResponseMediaType(javax.ws.rs.core.HttpHeaders headers)