Class StreamingResponseProvider
- java.lang.Object
-
- com.atlassian.bamboo.plugins.rest.common.StreamingResponseProvider
-
- All Implemented Interfaces:
javax.ws.rs.ext.MessageBodyWriter<StreamingResponse>
@Provider public class StreamingResponseProvider extends Object implements javax.ws.rs.ext.MessageBodyWriter<StreamingResponse>
Adds support forStreamingResponse
entities onResponse
s.This provider is registered with JAX-RS via an entry in
services/javax.ws.rs.ext.MessageBodyWriter
underMETA-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
isMessageBodyWriter<Object>
, so this writer always sorts before it in the list. That means, as long as the type being written implementsStreamingResponse
, this writer will be chosen to write it.- Since:
- 9.4.0
-
-
Constructor Summary
Constructors Constructor Description StreamingResponseProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
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)
-
-
-
Method Detail
-
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
-
-