com.sun.grizzly
Interface ProtocolFilter

All Known Implementing Classes:
AsyncProtocolFilter, DefaultProtocolFilter, EchoAsyncWriteQueueFilter, EchoFilter, LogFilter, ParserProtocolFilter, PUReadFilter, ReadFilter, ResourceAllocationFilter, SSLAsyncProtocolFilter, SSLDefaultProtocolFilter, SSLEchoAsyncWriteQueueFilter, SSLEchoFilter, SSLReadFilter, SuspendableFilter, UDPReadFilter, UDPWriteFilter

public interface ProtocolFilter

A ProtocolFilter encapsulates a unit of processing work to be performed, whose purpose is to examine and/or modify the state of a transaction that is represented by a ProtocolContext. Individual ProtocolFilter can be assembled into a ProtocolChain, which allows them to either complete the required processing or delegate further processing to the next ProtocolFilter in the ProtocolChain. ProtocolFilter implementations should be designed in a thread-safe manner, suitable for inclusion in multiple ProtocolChains that might be processed by different threads simultaneously. In general, this implies that ProtocolFilter classes should not maintain state information in instance variables. Instead, state information should be maintained via suitable modifications to the attributes of the ProtocolContext that is passed to the execute() and postExecute() methods. ProtocolFilter implementations typically retrieve and store state information in the ProtocolContext instance that is passed as a parameter to the execute() and postExecute method, using particular keys into the Map that can be acquired via ProtocolContext.getAttributes().

Author:
Jeanfrancois Arcand

Field Summary
static String SUCCESSFUL_READ
           
 
Method Summary
 boolean execute(Context ctx)
          Execute a unit of processing work to be performed.
 boolean postExecute(Context ctx)
          Execute any cleanup activities, such as releasing resources that were acquired during the execute() method of this ProtocolFilter instance.
 

Field Detail

SUCCESSFUL_READ

static final String SUCCESSFUL_READ
See Also:
Constant Field Values
Method Detail

execute

boolean execute(Context ctx)
                throws IOException
Execute a unit of processing work to be performed. This ProtocolFilter may either complete the required processing and return false, or delegate remaining processing to the next ProtocolFilter in a ProtocolChain containing this ProtocolFilter by returning true.

Parameters:
ctx - Context
Returns:
Throws:
IOException

postExecute

boolean postExecute(Context ctx)
                    throws IOException
Execute any cleanup activities, such as releasing resources that were acquired during the execute() method of this ProtocolFilter instance.

Parameters:
ctx - Context
Returns:
Throws:
IOException


Copyright © 2010 SUN Microsystems. All Rights Reserved.