org.jibx.ws.transport.interceptor
Class CopiedOutputStreamInterceptor

java.lang.Object
  extended by org.jibx.ws.transport.interceptor.CopiedOutputStreamInterceptor
All Implemented Interfaces:
OutputStreamInterceptor

public final class CopiedOutputStreamInterceptor
extends Object
implements OutputStreamInterceptor

An interceptor that sniffs the output on the way through.

It can run in two modes.

  1. If constructed with a callback, on completion it will invoke the callback with a copy of the input. This is convenient for use on the server side when using servlets (In order to access the outbound message context on the server, you will need to implement an OutputCompletionListener.
  2. If constructed with an output stream, it will copy the output to that output stream. This is convenient for using on the client side.


Constructor Summary
CopiedOutputStreamInterceptor(OutputStream copyStream)
          Constructor.
CopiedOutputStreamInterceptor(String attributeName)
          Constructor.
 
Method Summary
 OutputStream intercept(OutputStream outputStream)
          Allows the interceptor to hook into the output stream.
 void outputComplete()
          Notifies the interceptor that output is complete.
 void setMessageContext(OutContext ctx)
          Sets the outbound message context for the interceptor to store data in.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CopiedOutputStreamInterceptor

public CopiedOutputStreamInterceptor(String attributeName)
Constructor. When the input is complete, this will put the copy of the input into an attribute in the current MessageContext.

Parameters:
attributeName - the name of the attribute in which to store the result

CopiedOutputStreamInterceptor

public CopiedOutputStreamInterceptor(OutputStream copyStream)
Constructor. This will duplicate the output to the specified output stream.

Parameters:
copyStream - the stream to copy the output to
Method Detail

setMessageContext

public void setMessageContext(OutContext ctx)
Sets the outbound message context for the interceptor to store data in.

Specified by:
setMessageContext in interface OutputStreamInterceptor
Parameters:
ctx - outbound message context

intercept

public OutputStream intercept(OutputStream outputStream)
Allows the interceptor to hook into the output stream.

Specified by:
intercept in interface OutputStreamInterceptor
Parameters:
outputStream - the input stream of the message from the processor
Returns:
the output stream that will be presented to the transport

outputComplete

public void outputComplete()
Notifies the interceptor that output is complete.

Specified by:
outputComplete in interface OutputStreamInterceptor


Project Web Site