com.sun.grizzly.ssl
Class SSLFilter

java.lang.Object
  extended by com.sun.grizzly.filterchain.FilterAdapter
      extended by com.sun.grizzly.ssl.SSLFilter
All Implemented Interfaces:
Codec, CodecFilter, Filter, StreamTransformerFilter

public class SSLFilter
extends FilterAdapter
implements CodecFilter, StreamTransformerFilter

SSL Filter to operate with SSL encrypted data.

Author:
Alexey Stashok

Constructor Summary
SSLFilter()
           
SSLFilter(SSLEngineConfigurator sslEngineConfigurator)
          Build SSLFilter with the given SSLEngineConfigurator.
SSLFilter(SSLEngineConfigurator sslEngineConfigurator, SSLHandshaker sslHandshaker)
          Build SSLFilter with the given SSLEngineConfigurator and custom SSLHandshaker
 
Method Summary
 SSLSupport createSSLSupport(SSLStreamReader reader, SSLStreamWriter writer)
           
 Transformer getDecoder()
           
 Transformer getEncoder()
           
 StreamReader getStreamReader(StreamReader parentStreamReader)
           
 StreamWriter getStreamWriter(StreamWriter parentStreamWriter)
           
 NextAction handleRead(FilterChainContext ctx, NextAction nextAction)
          Wraps FilterChainContext default StreamReader and StreamWriter with SSL aware ones.
 NextAction handleWrite(FilterChainContext ctx, NextAction nextAction)
          Execute a unit of processing work to be performed, when channel will become available for writing.
 NextAction postClose(FilterChainContext ctx, NextAction nextAction)
          Execute any cleanup activities, such as releasing resources that were acquired during the execution of Filter#handleClose(com.sun.grizzly.FilterChainContext) method of this Filter instance.
 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.
 NextAction postWrite(FilterChainContext ctx, NextAction nextAction)
          Execute any cleanup activities, such as releasing resources that were acquired during the execution of Filter#handleWrite(com.sun.grizzly.FilterChainContext) method of this Filter instance.
 
Methods inherited from class com.sun.grizzly.filterchain.FilterAdapter
exceptionOccurred, getFilterChain, getIndex, handleAccept, handleClose, handleConnect, isIndexable, postAccept, postConnect, setIndex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sun.grizzly.filterchain.Filter
exceptionOccurred, handleAccept, handleClose, handleConnect, postAccept, postConnect
 

Constructor Detail

SSLFilter

public SSLFilter()

SSLFilter

public SSLFilter(SSLEngineConfigurator sslEngineConfigurator)
Build SSLFilter with the given SSLEngineConfigurator.

Parameters:
sslEngineConfigurator - SSLEngine configurator

SSLFilter

public SSLFilter(SSLEngineConfigurator sslEngineConfigurator,
                 SSLHandshaker sslHandshaker)
Build SSLFilter with the given SSLEngineConfigurator and custom SSLHandshaker

Parameters:
sslEngineConfigurator - SSLEngine configurator
Method Detail

handleRead

public NextAction handleRead(FilterChainContext ctx,
                             NextAction nextAction)
                      throws IOException
Wraps FilterChainContext default StreamReader and StreamWriter with SSL aware ones.

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
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
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

postWrite

public NextAction postWrite(FilterChainContext ctx,
                            NextAction nextAction)
                     throws IOException
Execute any cleanup activities, such as releasing resources that were acquired during the execution of Filter#handleWrite(com.sun.grizzly.FilterChainContext) method of this Filter instance.

Specified by:
postWrite in interface Filter
Overrides:
postWrite 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

postClose

public NextAction postClose(FilterChainContext ctx,
                            NextAction nextAction)
                     throws IOException
Execute any cleanup activities, such as releasing resources that were acquired during the execution of Filter#handleClose(com.sun.grizzly.FilterChainContext) method of this Filter instance.

Specified by:
postClose in interface Filter
Overrides:
postClose 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

getStreamReader

public StreamReader getStreamReader(StreamReader parentStreamReader)
Specified by:
getStreamReader in interface StreamTransformerFilter

getStreamWriter

public StreamWriter getStreamWriter(StreamWriter parentStreamWriter)
Specified by:
getStreamWriter in interface StreamTransformerFilter

createSSLSupport

public SSLSupport createSSLSupport(SSLStreamReader reader,
                                   SSLStreamWriter writer)

getDecoder

public Transformer getDecoder()
Specified by:
getDecoder in interface Codec

getEncoder

public Transformer getEncoder()
Specified by:
getEncoder in interface Codec


Copyright © 2009 SUN Microsystems. All Rights Reserved.