Apache Wink : 6.3 Input and Output Stream Adapters
This page last changed on Oct 13, 2009 by michael.
The Apache Wink Client provides the ability to manipulate raw Http input and output entity streams through the InputStreamAdapter and the OutputStreamAdapter interfaces. This is useful for modifying the input and output streams, regardless of the actual entity, for example when adding compression capabilities.
The adapt() method of the input stream adapter is called after the response status code and the headers are received in order to allow the adapter to behave accordingly.
The following example demonstrates how to implement input and output adapters.
The following code snippet is an example of adding a input and output adapters in the Gzip handler.
The Gzip handler creates instances of the GzipInputAdapter and the GzipOutputAdapter and adds them to the stream adapters of the current request by invoking the addInputStreamAdapter() method and the addOutputStreamAdapter() method on the HandlerContext instance.
The following code snippet is an example of an implementation of a Gzip input stream adapter.
The Gzip input stream adapter is responsible for wrapping the input stream with the Gzip input stream.
The following code snippet is an example of an implementation of a Gzip output stream adapter.
The Gzip output stream adapter is responsible for wrapping the output stream with the Gzip output stream.
|Document generated by Confluence on Nov 11, 2009 06:57|