Methods Summary |
---|
private void | addProtocol(java.lang.String protocol, com.sun.enterprise.web.portunif.PortUnificationPipeline pipeline, java.lang.ClassLoader classLoader)
String className = supportedProtocols.get(protocol);
if (className == null) {
SelectorThread.logger().log(Level.WARNING,
"Invalid proxied protocol value: " + protocol);
return;
}
ProtocolFinder finder =
(ProtocolFinder)loadInstance(className,classLoader);
if (finder != null){
pipeline.addProtocolFinder(finder);
}
|
private void | checkSocketFactory()Sanity check and socketFactory setup.
IMHO it is better to stop the show on a broken connector,
then leave Tomcat running and broken.
if ( !blocking && !secure) return;
SecureSelector secureSel = (SecureSelector)selectorThread;
if (secure) {
// The SSL setup code has been moved into
// SSLImplementation since SocketFactory doesn't
// provide a wide enough interface
sslImplementation =
SSLImplementation.getInstance(sslImplementationName);
socketFactory = sslImplementation.getServerSocketFactory();
secureSel.setSSLImplementation(sslImplementation);
secureSel.setEnabledCipherSuites(toStringArray(getCiphers()));
secureSel.setEnabledProtocols(toStringArray(getProtocols()));
String clientAuthStr = (String) getAttribute("clientauth");
if (clientAuthStr != null){
secureSel.setNeedClientAuth(
Boolean.valueOf(clientAuthStr).booleanValue());
}
} else if (socketFactoryName != null) {
socketFactory = string2SocketFactory(socketFactoryName);
}
if(socketFactory==null)
socketFactory=ServerSocketFactory.getDefault();
secureSel.setServerSocketFactory(socketFactory);
|
private void | configureProxiedProtocols()Configure the domain.xml proxied protocols.
PortUnificationPipeline pipeline = (PortUnificationPipeline)
selectorThread.getProcessorPipeline();
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
StringTokenizer st = new StringTokenizer(proxiedProtocols,",");
String className;
ProtocolFinder finder;
// By default, we must add an https finder if secure.
if (secure){
addProtocol(TLS,pipeline,classLoader);
}
String protocol;
while (st.hasMoreTokens()){
protocol = st.nextToken().toLowerCase();
if (protocol.equals(TLS) && secure){
continue;
} else if (protocol.equals(HTTP)){
continue;
}
addProtocol(protocol,pipeline,classLoader);
}
// Always add http finder at the end.
addProtocol(HTTP,pipeline,classLoader);
Iterator<String> iterator = supportedHandlers.iterator();
while(iterator.hasNext()){
ProtocolHandler handler =
(ProtocolHandler)loadInstance(iterator.next(),classLoader);
if (handler != null){
pipeline.addProtocolHandler(handler);
}
}
|
protected void | create()This method is called by the constructor of the Http11Protocol
superclass.
if (blocking){
selectorThread = new SelectorBlockingThread();
((SelectorBlockingThread)selectorThread).setSecure(secure);
} else if ( !secure ){
if (selectorThreadImpl != null){
try{
Class clazz = Class.forName(selectorThreadImpl);
selectorThread = (SelectorThread)clazz.newInstance();
} catch (Throwable t){
selectorThread.logger().log(Level.WARNING,
"Unable to load SelectorThread: " + selectorThreadImpl,t);
}
}
if ( selectorThread == null ){
selectorThread = new SelectorThread();
}
} else {
selectorThread = new SSLSelectorThread();
}
setSoLinger(-1);
setSoTimeout(Constants.DEFAULT_TIMEOUT * 1000);
setServerSoTimeout(Constants.DEFAULT_SERVER_SOCKET_TIMEOUT);
setTcpNoDelay(Constants.DEFAULT_TCP_NO_DELAY);
|
public void | destroy()
SelectorThread.logger().log(Level.INFO,
"grizzlyHttpProtocol.stop",
String.valueOf(getPort()));
if ( domain != null ){
jmxManagement.
unregisterComponent(new ObjectName(domain,"type", "Selector"));
}
selectorThread.stopEndpoint();
|
public java.net.InetAddress | getAddress()
return selectorThread.getAddress();
|
public int | getBacklog()
return selectorThread.getSsBackLog();
|
public java.lang.String | getCompressableMimeType()
return compressableMimeTypes;
|
public java.lang.String | getCompression()
return compression;
|
public int | getCompressionMinSize()
return compressionMinSize;
|
public java.lang.String | getDefaultResponseType()Return the default response type used
return selectorThread.getDefaultResponseType();
|
public boolean | getDisableUploadTimeout()
return disableUploadTimeout;
|
public boolean | getDisplayConfiguration()
return selectorThread.isDisplayConfiguration();
|
public java.lang.String | getForcedRequestType()Return the default request type used
return selectorThread.getForcedRequestType();
|
public boolean | getLargeFileCacheEnabled()Is the large file cache support enabled.
return selectorThread.isLargeFileCacheEnabled;
|
public static java.util.logging.Logger | getLogger()Return the logger used by the Grizzly classes.
return SelectorThread.getLogger();
|
public int | getMaxCacheEntries()Return the maximum entries this cache can contains.
return selectorThread.maxCacheEntries;
|
public long | getMaxEntrySize()Get the maximum size a FileCacheEntry can have.
return selectorThread.maxEntrySize;
|
public long | getMaxLargeCacheSize()Get the maximum cache size
return selectorThread.maxLargeFileCacheSize;
|
public int | getMaxProcessorWorkerThreads()Return the processor-thread used by this Selector
return selectorThread.getMaxProcessorWorkerThreads();
|
public int | getMaxReadWorkerThreads()Return the read-thread used by this Selector
return selectorThread.getMaxReadWorkerThreads();
|
public long | getMaxSmallCacheSize()Get the maximum cache size
return selectorThread.maxSmallFileCacheSize;
|
public int | getMaxThreads()
return selectorThread.getMaxThreads();
|
public long | getMinEntrySize()Get the maximum size a FileCacheEntry can have.
return selectorThread.minEntrySize;
|
public int | getMinProcessorQueueLength()Return the processor-queue-length value
on this Selector
return selectorThread.getMinProcessorQueueLength();
|
public int | getMinReadQueueLength()Return the reader-queue-length value
on this Selector
return selectorThread.getMinReadQueueLength();
|
public java.lang.String | getName()
String encodedAddr = "";
if (getAddress() != null) {
encodedAddr = "" + getAddress();
if (encodedAddr.startsWith("/"))
encodedAddr = encodedAddr.substring(1);
encodedAddr = URLEncoder.encode(encodedAddr) + "-";
}
return ("http-" + encodedAddr + selectorThread.getPort());
|
public java.lang.String | getNoCompressionUserAgents()
return noCompressionUserAgents;
|
public int | getPort()
return selectorThread.getPort();
|
public int | getProcessorThreadsIncrement()
return selectorThread.getThreadsIncrement();
|
public int | getProcessorWorkerThreadsTimeout()
return selectorThread.getThreadsTimeout();
|
public java.lang.String | getProxiedProtocols()
return proxiedProtocols;
|
public boolean | getRecycleTasks()Return the recycle-tasks used by this
Selector
return selectorThread.isRecycleTasks();
|
public java.lang.String | getRestrictedUserAgents()
return restrictedUserAgents;
|
public boolean | getReuseAddress()
return selectorThread.getReuseAddress();
|
public int | getSelectorTimeout()Return the Selector times out value.
return selectorThread.getSelectorTimeout();
|
public int | getServerSoTimeout()
return selectorThread.getServerSoTimeout();
|
public int | getSoLinger()
return selectorThread.getSoLinger();
|
public int | getSoTimeout()
return selectorThread.getSoTimeout();
|
public int | getSocketBuffer()
return socketBuffer;
|
public boolean | getTcpNoDelay()
return selectorThread.getTcpNoDelay();
|
public int | getTimeout()Get the upload timeout.
return selectorThread.getTimeout();
|
public boolean | getUseByteBufferView()
return selectorThread.isUseByteBufferView() ;
|
public boolean | getUseDirectByteBuffer()Return the use-nio-non-blocking used by this
Selector
return selectorThread.isUseDirectByteBuffer();
|
public java.lang.String | getWebAppRootPath()Return the folder's root where application are deployed.
return selectorThread.getRootFolder();
|
public void | init()Start the protocol
try {
checkSocketFactory();
} catch( Exception ex ) {
SelectorThread.logger().log(Level.SEVERE,
"grizzlyHttpProtocol.socketfactory.initerror",ex);
throw ex;
}
if( socketFactory!=null ) {
Enumeration attE=attributes.keys();
while( attE.hasMoreElements() ) {
String key=(String)attE.nextElement();
Object v=attributes.get( key );
socketFactory.setAttribute( key, v );
}
}
if ( secure && !blocking){
socketFactory.init();
((SSLSelectorThread)selectorThread)
.setSSLContext(socketFactory.getSSLContext());
}
try {
selectorThread.setAdapter(adapter);
if (proxiedProtocols != null||
System.getProperty(
PortUnificationPipeline.PROTOCOL_HANDLERS) != null){
selectorThread.pipelineClassName = com.sun.enterprise.web.
portunif.PortUnificationPipeline.class.getName();
}
selectorThread.initEndpoint();
if (proxiedProtocols != null && !blocking){
configureProxiedProtocols();
}
} catch (Exception ex) {
SelectorThread.logger().log(Level.SEVERE,
"grizzlyHttpProtocol.endpoint.initerror", ex);
throw ex;
}
|
public boolean | isFileCacheEnabled()Is the fileCache enabled.
return selectorThread.isFileCacheEnabled;
|
private java.lang.Object | loadInstance(java.lang.String name, java.lang.ClassLoader classLoader)Util to load classes using reflection.
if (name == null) return null;
Class className = null;
try{
className = Class.forName(name,true,classLoader);
return className.newInstance();
} catch (Throwable t) {
SelectorThread.logger().log(Level.WARNING,
"Error loading proxied protocol " + name, t);
}
return null;
|
public SelectorThread | selectorThread()Return the instance of SelectorThread used by this class.
return selectorThread;
|
public void | setAddress(java.net.InetAddress ia)
selectorThread.setAddress( ia );
setAttribute("address", "" + ia);
|
public void | setBacklog(int i)
;
|
public void | setBufferSize(int requestBufferSize)Set the request input buffer size
super.setBufferSize(requestBufferSize);
selectorThread.setBufferSize(requestBufferSize);
|
public void | setCometSupport(boolean cometSupport)
selectorThread.enableCometSupport(cometSupport);
|
public void | setCompressableMimeType(java.lang.String valueS)
compressableMimeTypes = valueS;
selectorThread.setCompressableMimeTypes(valueS);
|
public void | setCompression(java.lang.String valueS)
compression = valueS;
selectorThread.setCompression(compression);
|
public void | setCompressionMinSize(int valueI)
compressionMinSize = valueI;
selectorThread.setCompressionMinSize(valueI);
|
public void | setDefaultResponseType(java.lang.String defaultResponseType)Set the default response type used. Specified as a semi-colon
delimited string consisting of content-type, encoding,
language, charset
selectorThread.setDefaultResponseType(defaultResponseType);
|
public void | setDisableUploadTimeout(boolean isDisabled)
disableUploadTimeout = isDisabled;
selectorThread.setDisableUploadTimeout(disableUploadTimeout);
|
public void | setDisplayConfiguration(boolean displayConfiguration)
selectorThread.setDisplayConfiguration(displayConfiguration);
|
public void | setFileCacheEnabled(boolean isFileCacheEnabled)Is the file caching mechanism enabled.
selectorThread.isFileCacheEnabled = isFileCacheEnabled;
|
public void | setForcedRequestType(java.lang.String forcedResponseType)Sets the forced request type, which is forced onto requests that
do not already specify any MIME type.
selectorThread.setForcedRequestType(forcedResponseType);
|
public void | setKeepAliveThreadCount(int threadCount)Sets the number of keep-alive threads.
selectorThread.setKeepAliveThreadCount(threadCount);
|
public void | setKeepAliveTimeoutInSeconds(int timeout)Sets the number of seconds before a keep-alive connection that has
been idle times out and is closed.
selectorThread.setKeepAliveTimeoutInSeconds(timeout);
|
public void | setLargeFileCacheEnabled(boolean isLargeEnabled)Is the large file cache support enabled.
selectorThread.isLargeFileCacheEnabled = isLargeEnabled;
|
public static void | setLogger(java.util.logging.Logger logger)Set the logger
if ( logger != null )
SelectorThread.setLogger(logger);
|
public void | setMaxCacheEntries(int mEntries)Set the maximum entries this cache can contains.
selectorThread.maxCacheEntries = mEntries;
|
public void | setMaxEntrySize(long mEntrySize)Set the maximum size a FileCacheEntry can have.
selectorThread.maxEntrySize = mEntrySize;
|
public void | setMaxHttpHeaderSize(int maxHttpHeaderSize)
super.setMaxHttpHeaderSize(maxHttpHeaderSize);
selectorThread.setMaxHttpHeaderSize(maxHttpHeaderSize);
|
public void | setMaxKeepAliveRequests(int mkar)Set the maximum number of Keep-Alive requests that we will honor.
selectorThread.setMaxKeepAliveRequests(mkar);
|
public void | setMaxLargeCacheSize(long mCacheSize)Set the maximum cache size
selectorThread.maxLargeFileCacheSize = mCacheSize;
|
public void | setMaxPostSize(int maxPostSize)
selectorThread.setMaxPostSize(maxPostSize);
setAttribute("maxPostSize", maxPostSize);
|
public void | setMaxProcessorWorkerThreads(int maxProcessorWorkerThreads)Set the processor-thread from domain.xml
selectorThread.setMaxProcessorWorkerThreads(maxProcessorWorkerThreads);
|
public void | setMaxReadWorkerThreads(int maxReadWorkerThreads)Set the reader-thread from domain.xml.
selectorThread.setMaxReadWorkerThreads(maxReadWorkerThreads);
|
public void | setMaxSmallCacheSize(long mCacheSize)Set the maximum cache size
selectorThread.maxSmallFileCacheSize = mCacheSize;
|
public void | setMaxThreads(int maxThreads)
selectorThread.setMaxThreads(maxThreads);
setAttribute("maxThreads", "" + maxThreads);
|
public void | setMinEntrySize(long mSize)Set the maximum size a FileCacheEntry can have.
selectorThread.minEntrySize = mSize;
|
public void | setMinProcessorQueueLength(int minProcessorQueueLength)Set the processor-queue-length value
on this Selector
selectorThread.setMinProcessorQueueLength(minProcessorQueueLength);
|
public void | setMinReadQueueLength(int minReadQueueLength)Set the reader-queue-length value
on this Selector
selectorThread.setMinReadQueueLength(minReadQueueLength);
|
public void | setMinThreads(int minThreads)The minimun threads created at startup.
selectorThread.setMinThreads(minThreads);
|
public void | setNoCompressionUserAgents(java.lang.String valueS)
noCompressionUserAgents = valueS;
selectorThread.setNoCompressionUserAgents(valueS);
|
public void | setPort(int port)
selectorThread.setPort(port);
setAttribute("port", "" + port);
//this.port=port;
|
public void | setProcessorThreadsIncrement(int threadsIncrement)
selectorThread.setThreadsIncrement(threadsIncrement);
setAttribute("threadsIncrement", "" + threadsIncrement);
|
public void | setProcessorWorkerThreadsTimeout(int timeout)
selectorThread.setThreadsTimeout(timeout);
setAttribute("threadsTimeout", "" + timeout);
|
public void | setProxiedProtocols(java.lang.String proxiedProtocols)
this.proxiedProtocols = proxiedProtocols;
|
public void | setQueueSizeInBytes(int maxQueueSizeInBytes)Set the maximum pending connection this Pipeline
can handle.
selectorThread.setMaxQueueSizeInBytes(maxQueueSizeInBytes);
|
public void | setRcmSupport(boolean rcmSupport)
selectorThread.enableRcmSupport(rcmSupport);
|
public void | setRecycleTasks(boolean recycleTasks)Set the recycle-tasks by this Selector
selectorThread.setRecycleTasks(recycleTasks);
|
public void | setRestrictedUserAgents(java.lang.String valueS)
restrictedUserAgents = valueS;
selectorThread.setRestrictedUserAgents(valueS);
|
public void | setReuseAddress(boolean reuseAddress)
selectorThread.setReuseAddress(reuseAddress);
|
public void | setSecondsMaxAge(int sMaxAges)The timeout in seconds before remove a FileCacheEntry
from the fileCache
selectorThread.secondsMaxAge = sMaxAges;
|
public void | setSecure(boolean b)
super.setSecure(b);
|
public void | setSelectorReadThreadsCount(int selectorReadThreadsCount)Set the number of SelectorThread Grizzly will uses.
selectorThread.setSelectorReadThreadsCount(selectorReadThreadsCount);
|
public void | setSelectorTimeout(int selectorTimeout)Set the Selector times out value.
selectorThread.setSelectorTimeout(selectorTimeout);
|
public void | setServerSoTimeout(int i)
selectorThread.setServerSoTimeout(i);
setAttribute("serverSoTimeout", "" + i);
|
public void | setSoLinger(int i)
selectorThread.setSoLinger( i );
setAttribute("soLinger", "" + i);
|
public void | setSoTimeout(int i)
selectorThread.setSoTimeout(i);
setAttribute("soTimeout", "" + i);
|
public void | setSocketBuffer(int valueI)
socketBuffer = valueI;
|
public void | setSocketServerBacklog(int ssBackLog)Set the SocketServer backlog.
selectorThread.setSsBackLog(ssBackLog);
|
public void | setTcpNoDelay(boolean b)
selectorThread.setTcpNoDelay( b );
setAttribute("tcpNoDelay", "" + b);
|
public void | setTimeout(int timeout)Set the upload timeout.
selectorThread.setUploadTimeout(timeout);
|
public void | setUseByteBufferView(boolean useByteBufferView)
selectorThread.setUseByteBufferView(useByteBufferView);
|
public void | setUseDirectByteBuffer(boolean useDirectByteBuffer)Set the use-nio-non-blocking by this Selector
selectorThread.setUseDirectByteBuffer(useDirectByteBuffer);
|
public void | setWebAppRootPath(java.lang.String rootFolder)Set the documenr root folder
selectorThread.setRootFolder(rootFolder);
|
public void | start()
try {
if ( this.oname != null ) {
jmxManagement = new ModelerManagement();
selectorThread.setManagement(jmxManagement);
try {
ObjectName sname = new ObjectName(domain
+ ":type=Selector,name=http"
+ selectorThread.getPort());
jmxManagement.registerComponent(selectorThread, sname, null);
} catch (Exception ex) {
SelectorThread.logger().log(Level.SEVERE,
"grizzlyHttpProtocol.selectorRegistrationFailed", ex);
}
} else {
SelectorThread.logger().log(Level.INFO,
"grizzlyHttpProtocol.selectorRegisterProtocol");
}
selectorThread.start();
} catch (Exception ex) {
SelectorThread.logger().log(Level.SEVERE,
"grizzlyHttpProtocol.endpoint.starterror",
ex);
throw ex;
}
SelectorThread.logger().log(Level.INFO,
"grizzlyHttpProtocol.start", String.valueOf(getPort()));
|
private static final java.lang.String[] | toStringArray(java.lang.String list)
if ( list == null ) return null;
StringTokenizer st = new StringTokenizer(list,",");
String[] array = new String[st.countTokens()];
int i = 0;
while(st.hasMoreTokens()){
array[i++] = st.nextToken();
}
return array;
|