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
- Direct Known Subclasses:
ClientSecurityPipe,ServerSecurityPipe
public abstract class AbstractFilterPipeImpl extends AbstractPipeImpl
Default implementation ofPipethat 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
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractFilterPipeImpl(AbstractFilterPipeImpl that, PipeCloner cloner)protectedAbstractFilterPipeImpl(Pipe next)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidpreDestroy()Invoked before the last copy of the pipeline is about to be discarded, to givePipes a chance to clean up any resources.Packetprocess(Packet packet)
-
-
-
Field Detail
-
next
protected final Pipe next
Next pipe to call.
-
-
Constructor Detail
-
AbstractFilterPipeImpl
protected AbstractFilterPipeImpl(Pipe next)
-
AbstractFilterPipeImpl
protected AbstractFilterPipeImpl(AbstractFilterPipeImpl that, PipeCloner cloner)
-
-
Method Detail
-
process
public Packet process(Packet packet)
Description copied from interface:Pipe- 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 unconsumedMessage. 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:PipeInvoked before the last copy of the pipeline is about to be discarded, to givePipes a chance to clean up any resources.This can be used to invoke
PreDestroylifecycle 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:
preDestroyin interfacePipe- Overrides:
preDestroyin classAbstractPipeImpl
-
-