|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.glassfish.jersey.spi.ContentEncoder
@Contract public abstract class ContentEncoder
Standard contract for plugging in content encoding support. Provides a standard way of implementing encoding
WriterInterceptor and decoding ReaderInterceptor. Implementing this class ensures the encoding
supported by the implementation will be considered during the content negotiation phase when deciding which encoding
should be used based on the accepted encodings (and the associated quality parameters) in the request headers.
| Constructor Summary | |
|---|---|
protected |
ContentEncoder(java.lang.String... supportedEncodings)
Initializes this encoder implementation with the list of supported content encodings. |
| Method Summary | |
|---|---|
java.lang.Object |
aroundReadFrom(ReaderInterceptorContext context)
Interceptor method wrapping calls to MessageBodyReader.readFrom(java.lang.Class. |
void |
aroundWriteTo(WriterInterceptorContext context)
Interceptor method wrapping calls to MessageBodyWriter.writeTo(T, java.lang.Class>, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType, javax.ws.rs.core.MultivaluedMap. |
abstract java.io.InputStream |
decode(java.lang.String contentEncoding,
java.io.InputStream encodedStream)
Implementations of this method should take the encoded stream, wrap it and return a stream that can be used to read the decoded entity. |
abstract java.io.OutputStream |
encode(java.lang.String contentEncoding,
java.io.OutputStream entityStream)
Implementations of this method should take the entity stream, wrap it and return a stream that is encoded using the specified encoding. |
java.util.Set<java.lang.String> |
getSupportedEncodings()
Returns values of Content-Encoding header supported by this encoder. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected ContentEncoder(java.lang.String... supportedEncodings)
supportedEncodings - Values of Content-Encoding header supported by this encoding provider.| Method Detail |
|---|
public final java.util.Set<java.lang.String> getSupportedEncodings()
public abstract java.io.InputStream decode(java.lang.String contentEncoding,
java.io.InputStream encodedStream)
throws java.io.IOException
contentEncoding - Encoding to be used to decode the stream - guaranteed to be one of the supported encoding
values.encodedStream - Encoded input stream.
java.io.IOException - if an IO error arises.
public abstract java.io.OutputStream encode(java.lang.String contentEncoding,
java.io.OutputStream entityStream)
throws java.io.IOException
contentEncoding - Encoding to be used to encode the entity - guaranteed to be one of the supported encoding
values.entityStream - Entity stream to be encoded.
java.io.IOException - if an IO error arises.
public final java.lang.Object aroundReadFrom(ReaderInterceptorContext context)
throws java.io.IOException,
WebApplicationException
ReaderInterceptorMessageBodyReader.readFrom(java.lang.Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType, javax.ws.rs.core.MultivaluedMap, java.io.InputStream) . The parameters
of the wrapped method called are available from context.
Implementations of this method SHOULD explicitly call
ReaderInterceptorContext.proceed() to invoke
the next interceptor in the chain, and ultimately the wrapped method.
aroundReadFrom in interface ReaderInterceptorcontext - invocation context.
java.io.IOException - if an IO error arises.
WebApplicationException - thrown by wrapped method.
public final void aroundWriteTo(WriterInterceptorContext context)
throws java.io.IOException,
WebApplicationException
WriterInterceptorMessageBodyWriter.writeTo(T, java.lang.Class>, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType, javax.ws.rs.core.MultivaluedMap, java.io.OutputStream) .
The parameters of the wrapped method called are available from context.
Implementations of this method SHOULD explicitly call
WriterInterceptorContext.proceed() to invoke the next interceptor in the chain,
and ultimately the wrapped method.
aroundWriteTo in interface WriterInterceptorcontext - invocation context.
java.io.IOException - if an IO error arises.
WebApplicationException - thrown by wrapped method.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||