Class AbstractFilterPipeImpl

java.lang.Object
com.sun.xml.ws.api.pipe.helper.AbstractPipeImpl
com.sun.xml.ws.api.pipe.helper.AbstractFilterPipeImpl
All Implemented Interfaces:
Pipe

public abstract class AbstractFilterPipeImpl extends AbstractPipeImpl
Default implementation of Pipe that is used as a filter.

A filter pipe works on a Packet, then pass it onto the next pipe.

How do I implement a filter?

Filter Pipes are ideal for those components that wish to do some of the followings:

To read an incoming message and perform some work before the application (or more precisely the next pipe sees it)
Implement the process(com.sun.xml.ws.api.message.Packet) method and do some processing before you pass the packet to the next pipe:
 process(request) {
   doSomethingWith(request);
   return next.process(request);
 }
 
To intercept an incoming message and prevent the next pipe from seeing it.
Implement the process(com.sun.xml.ws.api.message.Packet) method and do some processing, then do NOT pass the request onto the next pipe.
 process(request) {
   if(isSomethingWrongWith(request))
     return createErrorMessage();
   else
     return next.proces(request);
 }
 
To post process a reply and possibly modify a message:
Implement the process(com.sun.xml.ws.api.message.Packet) method and do some processing, then do NOT pass the request onto the next pipe.
 process(request) {
   op = request.getMessage().getOperation();
   reply = next.proces(request);
   if(op is something I care) {
     reply = playWith(reply);
   }
   return reply;
 }
 
Author:
Kohsuke Kawaguchi
  • Field Details

    • next

      protected final Pipe next
      Next pipe to call.
  • Constructor Details

  • Method Details

    • process

      public Packet process(Packet packet)
      Description copied from interface: Pipe
      Sends a Packet and returns a response Packet to it.
      Parameters:
      packet - The packet that represents a request message. Must not be null. If the packet has a non-null message, it must be a valid unconsumed Message. This message represents the SOAP message to be sent as a request.

      The packet is also allowed to carry no message, which indicates that this is an output-only request. (that's called "solicit", right? - KK)

      Returns:
      The packet that represents a response message. Must not be null. If the packet has a non-null message, it must be a valid unconsumed Message. This message represents a response to the request message passed as a parameter.

      The packet is also allowed to carry no message, which indicates that there was no response. This is used for things like one-way message and/or one-way transports.

    • preDestroy

      public void preDestroy()
      Description copied from interface: Pipe
      Invoked before the last copy of the pipeline is about to be discarded, to give Pipes a chance to clean up any resources.

      This can be used to invoke PreDestroy lifecycle methods on user handler. The invocation of it is optional on the client side, but mandatory on the server side.

      When multiple copies of pipelines are created, this method is called only on one of them.

      Specified by:
      preDestroy in interface Pipe
      Overrides:
      preDestroy in class AbstractPipeImpl