com.sun.grizzly.ssl
Class SSLSelectorThread

java.lang.Object
  extended by java.lang.Thread
      extended by com.sun.grizzly.http.SelectorThread
          extended by com.sun.grizzly.ssl.SSLSelectorThread
All Implemented Interfaces:
SecureSelector<SSLImplementation>, Runnable, MBeanRegistration

public class SSLSelectorThread
extends SelectorThread
implements SecureSelector<SSLImplementation>

SSL over NIO Selector implementation. Mainly, this class replace the clear text implementation by defining the SSL tasks counterpart: SSLReadTask, SSLProcessorTask and SSLByteBufferInputStream. The SSLPipeline is the default and must not be replace unless all its attribute properly implemented.

Author:
Jean-Francois Arcand

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
protected  SSLContext sslContext
          The SSLContext associated with the SSL implementation we are running on.
 
Fields inherited from class com.sun.grizzly.http.SelectorThread
activeProcessorTasks, adapter, algorithmClass, algorithmClassName, asyncExecution, asyncHandler, bufferResponse, compressableMimeTypes, compression, compressionMinSize, controller, DEFAULT_ALGORITHM, defaultAlgorithmInstalled, defaultResponseType, disableUploadTimeout, displayConfiguration, domain, enableNioLogging, fileCacheFactory, forcedRequestType, globalRequestProcessor, globalRequestProcessorName, inet, initialized, isFileCacheEnabled, isLargeFileCacheEnabled, isMonitoringEnabled, keepAliveCounter, keepAliveThreadCount, keepAliveTimeoutInSeconds, linger, logger, maxCacheEntries, maxEntrySize, maxHttpHeaderSize, maxKeepAliveRequests, maxLargeFileCacheSize, maxPostSize, maxQueueSizeInBytes, maxSmallFileCacheSize, maxThreads, minEntrySize, minWorkerThreads, mserver, noCompressionUserAgents, oname, oOBInline, pipelineClassName, pipelineStat, port, portUnificationFilter, processorPipeline, processorTasks, processorWorkerThreadName, properties, rcmSupport, readThreadsCount, recycleTasks, requestBufferSize, restrictedUserAgents, rootFolder, running, secondsMaxAge, selector, selectorHandler, selectorTimeout, SERVER_NAME, serverTimeout, socketTimeout, ssBackLog, tcpNoDelay, threadsIncrement, threadsTimeout, uploadTimeout, useByteBufferView, useDirectByteBuffer
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
SSLSelectorThread()
           
 
Method Summary
protected  void configureFilters(ProtocolChain protocolChain)
          Adds and configures ProtocolChain's filters
protected  ProtocolFilter createHttpParserFilter()
          Create HTTP parser ProtocolFilter
protected  TCPSelectorHandler createSelectorHandler()
          Create TCPSelectorHandler
 String[] getEnabledCipherSuites()
          Returns the list of cipher suites to be enabled when SSLEngine is initialized.
 String[] getEnabledProtocols()
          Returns the list of protocols to be enabled when SSLEngine is initialized.
 SSLContext getSSLContext()
          Return the SSLContext required to support SSL over NIO.
 SSLImplementation getSSLImplementation()
          Return the current SSLImplementation this Thread
protected  void initFileCacheFactory()
          Initialize the fileCacheFactory associated with this instance
 boolean isClientMode()
          Returns true if the SSlEngine is set to use client mode when handshaking.
 boolean isNeedClientAuth()
          Returns true if the SSLEngine will require client authentication.
 boolean isWantClientAuth()
          Returns true if the engine will request client authentication.
protected  ProcessorTask newProcessorTask(boolean initialize)
          Create SSLProcessorTask objects and configure it to be ready to proceed request.
 void setClientMode(boolean clientMode)
          Configures the engine to use client (or server) mode when handshaking.
 void setEnabledCipherSuites(String[] enabledCipherSuites)
          Sets the list of cipher suites to be enabled when SSLEngine is initialized.
 void setEnabledProtocols(String[] enabledProtocols)
          Sets the list of protocols to be enabled when SSLEngine is initialized.
 void setNeedClientAuth(boolean needClientAuth)
          Configures the engine to require client authentication.
 void setSSLConfig(SSLConfig sslConfig)
          Set the SSLContext required to support SSL over NIO.
 void setSSLContext(SSLContext sslContext)
          Set the SSLContext required to support SSL over NIO.
 void setSSLImplementation(SSLImplementation sslImplementation)
          Set the Coyote SSLImplementation.
 void setWantClientAuth(boolean wantClientAuth)
          Configures the engine to request client authentication.
 
Methods inherited from class com.sun.grizzly.http.SelectorThread
cancelKey, clearTasks, configureCompression, configurePortUnification, configurePortUnification, configureProcessorTask, configureSelectorHandler, createRaFilter, disableMonitoring, disablePipelineStats, enableMonitoring, enablePipelineStats, enableRcmSupport, getActiveProcessorTasks, getAdapter, getAddress, getAlgorithmClassName, getAsyncHandler, getBufferResponse, getBufferSize, getClassLoader, getCompressableMimeTypes, getCompression, getCompressionMinSize, getController, getCurrentBusyProcessorThreads, getDefaultResponseType, getDisableUploadTimeout, getDomain, getEnableAsyncExecution, getForcedRequestType, getGlobalRequestProcessor, getInet, getKeepAliveCounter, getKeepAliveStats, getKeepAliveThreadCount, getKeepAliveTimeoutInSeconds, getLargeFileCacheEnabled, getLinger, getManagement, getMaxCacheEntries, getMaxEntrySize, getMaxHttpHeaderSize, getMaxKeepAliveRequests, getMaxLargeCacheSize, getMaxPostSize, getMaxQueueSizeInBytes, getMaxSmallCacheSize, getMaxThreads, getMinEntrySize, getMinWorkerThreads, getNoCompressionUserAgents, getObjectName, getPipelineClassName, getPort, getPortLowLevel, getProcessorPipeline, getProcessorTask, getProperty, getQueueSizeInBytes, getRequestGroupInfo, getRestrictedUserAgents, getReuseAddress, getSelector, getSelector, getSelectorReadThreadsCount, getSelectors, getSelectorThreadKeyHandler, getSelectorTimeout, getServerTimeout, getSocketTimeout, getSsBackLog, getTcpNoDelay, getThreadsIncrement, getUploadTimeout, getWebAppRootPath, initAlgorithm, initController, initEndpoint, initKeepAliveCounter, initMonitoringLevel, initPipeline, initProcessorTask, isEnableNioLogging, isFileCacheEnabled, isMonitoringEnabled, isRcmSupported, isRunning, isUseByteBufferView, isUseDirectByteBuffer, listen, logger, newPipeline, postDeregister, postRegister, preDeregister, preRegister, rampUpProcessorTask, reconfigureAsyncExecution, registerComponents, registerKey, removeCacheEntry, removeProperty, returnTask, run, setAdapter, setAddress, setAlgorithmClassName, setAsyncHandler, setBufferResponse, setBufferSize, setClassLoader, setCompressableMimeTypes, setCompression, setCompressionMinSize, setController, setDefaultResponseType, setDisableUploadTimeout, setDisplayConfiguration, setEnableAsyncExecution, setEnableNioLogging, setFileCacheIsEnabled, setForcedRequestType, setInet, setKeepAliveThreadCount, setKeepAliveTimeoutInSeconds, setLargeFileCacheEnabled, setLinger, setLogger, setManagement, setMaxCacheEntries, setMaxEntrySize, setMaxHttpHeaderSize, setMaxKeepAliveRequests, setMaxLargeCacheSize, setMaxPostSize, setMaxQueueSizeInBytes, setMaxSmallCacheSize, setMaxThreads, setMinEntrySize, setMinThreads, setMinWorkerThreads, setNoCompressionUserAgents, setPipelineClassName, setPort, setProperty, setRestrictedUserAgents, setReuseAddress, setSecondsMaxAge, setSelectorReadThreadsCount, setSelectorTimeout, setServerTimeout, setSocketOptions, setSocketTimeout, setSsBackLog, setTcpNoDelay, setThreadsIncrement, setUploadTimeout, setUseByteBufferView, setUseDirectByteBuffer, setWebAppRootPath, startEndpoint, startListener, startPipelines, stopEndpoint, stopPipelines, unregisterComponents
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sslContext

protected SSLContext sslContext
The SSLContext associated with the SSL implementation we are running on.

Constructor Detail

SSLSelectorThread

public SSLSelectorThread()
Method Detail

createSelectorHandler

protected TCPSelectorHandler createSelectorHandler()
Create TCPSelectorHandler

Overrides:
createSelectorHandler in class SelectorThread

createHttpParserFilter

protected ProtocolFilter createHttpParserFilter()
Create HTTP parser ProtocolFilter

Overrides:
createHttpParserFilter in class SelectorThread
Returns:
HTTP parser ProtocolFilter

configureFilters

protected void configureFilters(ProtocolChain protocolChain)
Adds and configures ProtocolChain's filters

Overrides:
configureFilters in class SelectorThread

newProcessorTask

protected ProcessorTask newProcessorTask(boolean initialize)
Create SSLProcessorTask objects and configure it to be ready to proceed request.

Overrides:
newProcessorTask in class SelectorThread

setSSLConfig

public void setSSLConfig(SSLConfig sslConfig)
Set the SSLContext required to support SSL over NIO.


setSSLContext

public void setSSLContext(SSLContext sslContext)
Set the SSLContext required to support SSL over NIO.


getSSLContext

public SSLContext getSSLContext()
Return the SSLContext required to support SSL over NIO.


setSSLImplementation

public void setSSLImplementation(SSLImplementation sslImplementation)
Set the Coyote SSLImplementation.

Specified by:
setSSLImplementation in interface SecureSelector<SSLImplementation>

getSSLImplementation

public SSLImplementation getSSLImplementation()
Return the current SSLImplementation this Thread


getEnabledCipherSuites

public String[] getEnabledCipherSuites()
Returns the list of cipher suites to be enabled when SSLEngine is initialized.

Specified by:
getEnabledCipherSuites in interface SecureSelector<SSLImplementation>
Returns:
null means 'use SSLEngine's default.'

setEnabledCipherSuites

public void setEnabledCipherSuites(String[] enabledCipherSuites)
Sets the list of cipher suites to be enabled when SSLEngine is initialized.

Specified by:
setEnabledCipherSuites in interface SecureSelector<SSLImplementation>
Parameters:
cipherSuites - null means 'use SSLEngine's default.'

getEnabledProtocols

public String[] getEnabledProtocols()
Returns the list of protocols to be enabled when SSLEngine is initialized.

Specified by:
getEnabledProtocols in interface SecureSelector<SSLImplementation>
Returns:
null means 'use SSLEngine's default.'

setEnabledProtocols

public void setEnabledProtocols(String[] enabledProtocols)
Sets the list of protocols to be enabled when SSLEngine is initialized.

Specified by:
setEnabledProtocols in interface SecureSelector<SSLImplementation>
Parameters:
enabledProtocols - null means 'use SSLEngine's default.'

isClientMode

public boolean isClientMode()
Returns true if the SSlEngine is set to use client mode when handshaking.

Specified by:
isClientMode in interface SecureSelector<SSLImplementation>
Returns:
is client mode enabled

setClientMode

public void setClientMode(boolean clientMode)
Configures the engine to use client (or server) mode when handshaking.

Specified by:
setClientMode in interface SecureSelector<SSLImplementation>

isNeedClientAuth

public boolean isNeedClientAuth()
Returns true if the SSLEngine will require client authentication.

Specified by:
isNeedClientAuth in interface SecureSelector<SSLImplementation>

setNeedClientAuth

public void setNeedClientAuth(boolean needClientAuth)
Configures the engine to require client authentication.

Specified by:
setNeedClientAuth in interface SecureSelector<SSLImplementation>

isWantClientAuth

public boolean isWantClientAuth()
Returns true if the engine will request client authentication.

Specified by:
isWantClientAuth in interface SecureSelector<SSLImplementation>

setWantClientAuth

public void setWantClientAuth(boolean wantClientAuth)
Configures the engine to request client authentication.

Specified by:
setWantClientAuth in interface SecureSelector<SSLImplementation>

initFileCacheFactory

protected void initFileCacheFactory()
Initialize the fileCacheFactory associated with this instance

Overrides:
initFileCacheFactory in class SelectorThread


Copyright © 2009 SUN Microsystems. All Rights Reserved.