org.glassfish.grizzly.smart
Class SmartFilter<K>

java.lang.Object
  extended by org.glassfish.grizzly.filterchain.FilterAdapter
      extended by org.glassfish.grizzly.smart.SmartFilter<K>
All Implemented Interfaces:
Codec<Buffer,K>, CodecFilter<Buffer,K>, Filter

public class SmartFilter<K>
extends FilterAdapter
implements CodecFilter<Buffer,K>

Author:
oleksiys

Constructor Summary
SmartFilter(Class clazz)
           
SmartFilter(SmartCodec<K> smartCodec)
           
SmartFilter(SmartCodec<K> smartCodec, AttributeBuilder attrBuilder)
           
 
Method Summary
 Transformer<Buffer,K> getDecoder()
           
 Transformer<K,Buffer> getEncoder()
           
 NextAction handleRead(FilterChainContext ctx, NextAction nextAction)
          Execute a unit of processing work to be performed, when channel will become available for reading.
 NextAction handleWrite(FilterChainContext ctx, NextAction nextAction)
          Execute a unit of processing work to be performed, when channel will become available for writing.
 NextAction postRead(FilterChainContext ctx, NextAction nextAction)
          Execute any cleanup activities, such as releasing resources that were acquired during the execution of Filter#handleRead(com.sun.grizzly.FilterChainContext) method of this Filter instance.
 
Methods inherited from class org.glassfish.grizzly.filterchain.FilterAdapter
exceptionOccurred, getFilterChain, getIndex, handleAccept, handleClose, handleConnect, isIndexable, postAccept, postClose, postConnect, postWrite, setIndex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.glassfish.grizzly.filterchain.Filter
exceptionOccurred, getIndex, handleAccept, handleClose, handleConnect, isIndexable, postAccept, postClose, postConnect, postWrite, setIndex
 

Constructor Detail

SmartFilter

public SmartFilter(Class clazz)

SmartFilter

public SmartFilter(SmartCodec<K> smartCodec)

SmartFilter

public SmartFilter(SmartCodec<K> smartCodec,
                   AttributeBuilder attrBuilder)
Method Detail

handleRead

public NextAction handleRead(FilterChainContext ctx,
                             NextAction nextAction)
                      throws IOException
Description copied from class: FilterAdapter
Execute a unit of processing work to be performed, when channel will become available for reading. This Filter may either complete the required processing and return false, or delegate remaining processing to the next Filter in a FilterChain containing this Filter by returning true.

Specified by:
handleRead in interface Filter
Overrides:
handleRead in class FilterAdapter
Parameters:
ctx - FilterChainContext
nextAction - default NextAction, which Filter could change in order to control how FilterChain will continue the execution
Returns:
NextAction instruction for FilterChain, how it should continue the execution
Throws:
IOException

postRead

public NextAction postRead(FilterChainContext ctx,
                           NextAction nextAction)
                    throws IOException
Description copied from class: FilterAdapter
Execute any cleanup activities, such as releasing resources that were acquired during the execution of Filter#handleRead(com.sun.grizzly.FilterChainContext) method of this Filter instance.

Specified by:
postRead in interface Filter
Overrides:
postRead in class FilterAdapter
Parameters:
ctx - FilterChainContext
nextAction - default NextAction, which Filter could change in order to control how FilterChain will continue the execution
Returns:
NextAction instruction for FilterChain, how it should continue the execution
Throws:
IOException

handleWrite

public NextAction handleWrite(FilterChainContext ctx,
                              NextAction nextAction)
                       throws IOException
Description copied from class: FilterAdapter
Execute a unit of processing work to be performed, when channel will become available for writing. This Filter may either complete the required processing and return false, or delegate remaining processing to the next Filter in a FilterChain containing this Filter by returning true.

Specified by:
handleWrite in interface Filter
Overrides:
handleWrite in class FilterAdapter
Parameters:
ctx - FilterChainContext
nextAction - default NextAction, which Filter could change in order to control how FilterChain will continue the execution
Returns:
NextAction instruction for FilterChain, how it should continue the execution
Throws:
IOException

getDecoder

public Transformer<Buffer,K> getDecoder()
Specified by:
getDecoder in interface Codec<Buffer,K>

getEncoder

public Transformer<K,Buffer> getEncoder()
Specified by:
getEncoder in interface Codec<Buffer,K>


Copyright © 2009 SUN Microsystems. All Rights Reserved.