Class StreamingResponseProvider
java.lang.Object
com.atlassian.bamboo.plugins.rest.common.StreamingResponseProvider
- All Implemented Interfaces:
javax.ws.rs.ext.MessageBodyWriter<StreamingResponse>
@Produces("image/png")
@Provider
public class StreamingResponseProvider
extends Object
implements javax.ws.rs.ext.MessageBodyWriter<StreamingResponse>
Adds support for
StreamingResponse
entities on Response
s.
This provider is registered with JAX-RS via an entry in services/javax.ws.rs.ext.MessageBodyWriter
under META-INF
.
When writers are registered as part of Jersey's startup, the per-media-type mapping is sorted by how far the
type parameter is from Object
. This encourages Jersey to choose more specialized writers over generic
ones. JacksonJaxbJsonProvider
is MessageBodyWriter<Object>
, so this writer always
sorts before it in the list. That means, as long as the type being written implements StreamingResponse
,
this writer will be chosen to write it.
- Since:
- 9.4.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
getSize
(StreamingResponse streamingResponse, Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType) boolean
isWriteable
(Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType) void
writeTo
(StreamingResponse response, Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream)
-
Constructor Details
-
StreamingResponseProvider
public StreamingResponseProvider()
-
-
Method Details
-
getSize
public long getSize(StreamingResponse streamingResponse, Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType) - Specified by:
getSize
in interfacejavax.ws.rs.ext.MessageBodyWriter<StreamingResponse>
-
isWriteable
public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType) - Specified by:
isWriteable
in interfacejavax.ws.rs.ext.MessageBodyWriter<StreamingResponse>
-
writeTo
public void writeTo(StreamingResponse response, Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, javax.ws.rs.WebApplicationException- Specified by:
writeTo
in interfacejavax.ws.rs.ext.MessageBodyWriter<StreamingResponse>
- Throws:
IOException
javax.ws.rs.WebApplicationException
-