- java.lang.Object
-
- org.eclipse.persistence.jpa.rs.util.StreamingOutputMarshaller
-
- All Implemented Interfaces:
jakarta.ws.rs.core.StreamingOutput
public class StreamingOutputMarshaller extends Object implements jakarta.ws.rs.core.StreamingOutput
SimpleStreamingOutputimplementation that uses the providedJAXBContextto 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, Object result, jakarta.ws.rs.core.MediaType acceptedType)StreamingOutputMarshaller(PersistenceContext context, Object result, List<jakarta.ws.rs.core.MediaType> acceptedTypes)Creates a new StreamingOutputMarshaller.StreamingOutputMarshaller(PersistenceContext context, Object result, List<jakarta.ws.rs.core.MediaType> acceptedTypes, FieldsFilter filter)This constructor is used for fields filtering.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static jakarta.xml.bind.MarshallercreateMarshaller(PersistenceContext context, jakarta.ws.rs.core.MediaType mediaType)static jakarta.ws.rs.core.MediaTypegetResponseMediaType(jakarta.ws.rs.core.HttpHeaders headers)static jakarta.ws.rs.core.MediaTypemediaType(List<jakarta.ws.rs.core.MediaType> types)Identify the preferredMediaTypefrom the list provided.voidwrite(OutputStream output)
-
-
-
Constructor Detail
-
StreamingOutputMarshaller
public StreamingOutputMarshaller(PersistenceContext context, Object result, jakarta.ws.rs.core.MediaType acceptedType)
-
StreamingOutputMarshaller
public StreamingOutputMarshaller(PersistenceContext context, Object result, List<jakarta.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, Object result, List<jakarta.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(OutputStream output) throws IOException, jakarta.ws.rs.WebApplicationException
- Specified by:
writein interfacejakarta.ws.rs.core.StreamingOutput- Throws:
IOExceptionjakarta.ws.rs.WebApplicationException
-
mediaType
public static jakarta.ws.rs.core.MediaType mediaType(List<jakarta.ws.rs.core.MediaType> types)
Identify the preferredMediaTypefrom the list provided. This will check for JSON string orMediaTypefirst then XML.- Parameters:
types- List ofMediaTypevalues;- Returns:
- selected
MediaType
-
createMarshaller
public static jakarta.xml.bind.Marshaller createMarshaller(PersistenceContext context, jakarta.ws.rs.core.MediaType mediaType) throws jakarta.xml.bind.JAXBException
- Throws:
jakarta.xml.bind.JAXBException
-
getResponseMediaType
public static jakarta.ws.rs.core.MediaType getResponseMediaType(jakarta.ws.rs.core.HttpHeaders headers)
-
-