FileDocCategorySizeDatePackage
Http11AprProtocol.javaAPI DocApache Tomcat 6.0.1427358Fri Jul 20 04:20:34 BST 2007org.apache.coyote.http11

Http11AprProtocol

public class Http11AprProtocol extends Object implements org.apache.coyote.ProtocolHandler, MBeanRegistration
Abstract the protocol implementation, including threading, etc. Processor is single threaded and specific to stream-based protocols, will not fit Jk protocols like JNI.
author
Remy Maucherat
author
Costin Manolache

Fields Summary
protected static org.apache.juli.logging.Log
log
protected static org.apache.tomcat.util.res.StringManager
sm
The string manager for this package.
protected org.apache.coyote.Adapter
adapter
The adapter, used to call the connector.
ObjectName
tpOname
ObjectName
rgOname
protected org.apache.tomcat.util.net.AprEndpoint
endpoint
protected HashMap
attributes
private Http11ConnectionHandler
cHandler
protected int
processorCache
Processor cache.
protected int
socketBuffer
protected int
maxSavePostSize
Maximum size of the post which will be saved when processing certain requests, such as a POST.
protected int
maxHttpHeaderSize
Maximum size of the HTTP message header.
protected boolean
disableUploadTimeout
If true, the regular socket timeout will be used for the full duration of the connection.
protected String
compression
Integrated compression support.
protected String
noCompressionUserAgents
protected String
compressableMimeTypes
protected int
compressionMinSize
protected String
restrictedUserAgents
User agents regular expressions which should be restricted to HTTP/1.0 support.
protected int
maxKeepAliveRequests
Maximum number of requests which can be performed over a keepalive connection. The default is the same as for Apache HTTP Server.
protected String
server
Server header.
protected int
timeout
This timeout represents the socket timeout which will be used while the adapter execution is in progress, unless disableUploadTimeout is set to true. The default is the same as for Apache HTTP Server (300 000 milliseconds).
protected boolean
secure
This field indicates if the protocol is secure from the perspective of the client (= https is used).
protected String
domain
protected ObjectName
oname
protected MBeanServer
mserver
Constructors Summary
public Http11AprProtocol()


      
        setSoLinger(Constants.DEFAULT_CONNECTION_LINGER);
        setSoTimeout(Constants.DEFAULT_CONNECTION_TIMEOUT);
        //setServerSoTimeout(Constants.DEFAULT_SERVER_SOCKET_TIMEOUT);
        setTcpNoDelay(Constants.DEFAULT_TCP_NO_DELAY);
    
Methods Summary
public voiddestroy()

        if(log.isInfoEnabled())
            log.info(sm.getString("http11protocol.stop", getName()));
        endpoint.destroy();
        if( tpOname!=null )
            Registry.getRegistry(null, null).unregisterComponent(tpOname);
        if( rgOname != null )
            Registry.getRegistry(null, null).unregisterComponent(rgOname);
    
public org.apache.coyote.AdaptergetAdapter()

 return adapter; 
public java.net.InetAddressgetAddress()

 return endpoint.getAddress(); 
public java.lang.ObjectgetAttribute(java.lang.String key)

        if( log.isTraceEnabled())
            log.trace(sm.getString("http11protocol.getattribute", key));
        return attributes.get(key);
    
public java.util.IteratorgetAttributeNames()

        return attributes.keySet().iterator();
    
public intgetBacklog()

 return endpoint.getBacklog(); 
public java.lang.StringgetCompressableMimeType()

        return compressableMimeTypes; 
public java.lang.StringgetCompression()

        return compression; 
public intgetCompressionMinSize()

        return compressionMinSize; 
public booleangetDisableUploadTimeout()

        return disableUploadTimeout; 
public java.lang.StringgetDomain()

        return domain;
    
public java.util.concurrent.ExecutorgetExecutor()

 return endpoint.getExecutor(); 
public booleangetKeepAlive()
Return the Keep-Alive policy for the connection.

        return ((maxKeepAliveRequests != 0) && (maxKeepAliveRequests != 1));
    
public intgetKeepAliveTimeout()
The number of seconds Tomcat will wait for a subsequent request before closing the connection.

 return endpoint.getKeepAliveTimeout(); 
public intgetMaxHttpHeaderSize()

        return maxHttpHeaderSize; 
public intgetMaxKeepAliveRequests()

        return maxKeepAliveRequests; 
public intgetMaxSavePostSize()

        return maxSavePostSize; 
public intgetMaxThreads()

 return endpoint.getMaxThreads(); 
public java.lang.StringgetName()

        String encodedAddr = "";
        if (getAddress() != null) {
            encodedAddr = "" + getAddress();
            if (encodedAddr.startsWith("/"))
                encodedAddr = encodedAddr.substring(1);
            encodedAddr = URLEncoder.encode(encodedAddr) + "-";
        }
        return ("http-" + encodedAddr + endpoint.getPort());
    
public java.lang.StringgetNoCompressionUserAgents()

        return noCompressionUserAgents; 
public javax.management.ObjectNamegetObjectName()

        return oname;
    
public intgetPollTime()

 return endpoint.getPollTime(); 
public intgetPollerSize()

 return endpoint.getPollerSize(); 
public intgetPort()

 return endpoint.getPort(); 
public intgetProcessorCache()

        return this.processorCache; 
public java.lang.StringgetProperty(java.lang.String name)
Get a property

        return (String)getAttribute(name);
    
public java.lang.StringgetProtocol()

        return getProperty("protocol");
    
public java.lang.StringgetRestrictedUserAgents()

        return restrictedUserAgents; 
public java.lang.StringgetSSLCACertificateFile()
SSL CA certificate file.

 return endpoint.getSSLCACertificateFile(); 
public java.lang.StringgetSSLCACertificatePath()
SSL CA certificate path.

 return endpoint.getSSLCACertificatePath(); 
public java.lang.StringgetSSLCARevocationFile()
SSL CA revocation file.

 return endpoint.getSSLCARevocationFile(); 
public java.lang.StringgetSSLCARevocationPath()
SSL CA revocation path.

 return endpoint.getSSLCARevocationPath(); 
public java.lang.StringgetSSLCertificateChainFile()
SSL certificate chain file.

 return endpoint.getSSLCertificateChainFile(); 
public java.lang.StringgetSSLCertificateFile()
SSL certificate file.

 return endpoint.getSSLCertificateFile(); 
public java.lang.StringgetSSLCertificateKeyFile()
SSL certificate key file.

 return endpoint.getSSLCertificateKeyFile(); 
public java.lang.StringgetSSLCipherSuite()
SSL cipher suite.

 return endpoint.getSSLCipherSuite(); 
public java.lang.StringgetSSLPassword()
SSL password (if a cert is encrypted, and no password has been provided, a callback will ask for a password).

 return endpoint.getSSLPassword(); 
public java.lang.StringgetSSLProtocol()
SSL protocol.

 return endpoint.getSSLProtocol(); 
public java.lang.StringgetSSLVerifyClient()
SSL verify client.

 return endpoint.getSSLVerifyClient(); 
public intgetSSLVerifyDepth()
SSL verify depth.

 return endpoint.getSSLVerifyDepth(); 
public booleangetSecure()

 return secure; 
public intgetSendfileSize()

 return endpoint.getSendfileSize(); 
public java.lang.StringgetServer()

 return server; 
public intgetSoLinger()

 return endpoint.getSoLinger(); 
public intgetSoTimeout()

 return endpoint.getSoTimeout(); 
public intgetSocketBuffer()

        return socketBuffer; 
public booleangetTcpNoDelay()

 return endpoint.getTcpNoDelay(); 
public intgetThreadPriority()

 return endpoint.getThreadPriority(); 
public intgetTimeout()

        return timeout; 
public booleangetUseSendfile()

 return endpoint.getUseSendfile(); 
public voidinit()
Start the protocol

        endpoint.setName(getName());
        endpoint.setHandler(cHandler);

        try {
            endpoint.init();
        } catch (Exception ex) {
            log.error(sm.getString("http11protocol.endpoint.initerror"), ex);
            throw ex;
        }
        if(log.isInfoEnabled())
            log.info(sm.getString("http11protocol.init", getName()));

    
public booleanisSSLEnabled()
SSL engine.

 return endpoint.isSSLEnabled(); 
public voidpause()

        try {
            endpoint.pause();
        } catch (Exception ex) {
            log.error(sm.getString("http11protocol.endpoint.pauseerror"), ex);
            throw ex;
        }
        if(log.isInfoEnabled())
            log.info(sm.getString("http11protocol.pause", getName()));
    
public voidpostDeregister()

    
public voidpostRegister(java.lang.Boolean registrationDone)

    
public voidpreDeregister()

    
public javax.management.ObjectNamepreRegister(javax.management.MBeanServer server, javax.management.ObjectName name)

        oname=name;
        mserver=server;
        domain=name.getDomain();
        return name;
    
public voidresume()

        try {
            endpoint.resume();
        } catch (Exception ex) {
            log.error(sm.getString("http11protocol.endpoint.resumeerror"), ex);
            throw ex;
        }
        if(log.isInfoEnabled())
            log.info(sm.getString("http11protocol.resume", getName()));
    
public voidsetAdapter(org.apache.coyote.Adapter adapter)

 this.adapter = adapter; 
public voidsetAddress(java.net.InetAddress ia)

 endpoint.setAddress(ia); 
public voidsetAttribute(java.lang.String name, java.lang.Object value)
Pass config info

        if( log.isTraceEnabled())
            log.trace(sm.getString("http11protocol.setattribute", name, value));

        attributes.put(name, value);
    
public voidsetBacklog(int backlog)

 endpoint.setBacklog(backlog); 
public voidsetCompressableMimeType(java.lang.String valueS)

 compressableMimeTypes = valueS; 
public voidsetCompression(java.lang.String valueS)

 compression = valueS; 
public voidsetCompressionMinSize(int valueI)

 compressionMinSize = valueI; 
public voidsetDisableUploadTimeout(boolean isDisabled)

 disableUploadTimeout = isDisabled; 
public voidsetExecutor(java.util.concurrent.Executor executor)

 endpoint.setExecutor(executor); 
public voidsetKeepAlive(boolean keepAlive)
Set the keep-alive policy for this connection.

        if (!keepAlive) {
            setMaxKeepAliveRequests(1);
        }
    
public voidsetKeepAliveTimeout(int timeout)

 endpoint.setKeepAliveTimeout(timeout); 
public voidsetMaxHttpHeaderSize(int valueI)

 maxHttpHeaderSize = valueI; 
public voidsetMaxKeepAliveRequests(int mkar)

 maxKeepAliveRequests = mkar; 
public voidsetMaxSavePostSize(int valueI)

 maxSavePostSize = valueI; 
public voidsetMaxThreads(int maxThreads)

 endpoint.setMaxThreads(maxThreads); 
public voidsetNoCompressionUserAgents(java.lang.String valueS)

 noCompressionUserAgents = valueS; 
public voidsetPollTime(int pollTime)

 endpoint.setPollTime(pollTime); 
public voidsetPollerSize(int pollerSize)

 endpoint.setPollerSize(pollerSize); 
public voidsetPort(int port)

 endpoint.setPort(port); 
public voidsetProcessorCache(int processorCache)

 this.processorCache = processorCache; 
public voidsetProperty(java.lang.String name, java.lang.String value)
Set a property.

        setAttribute(name, value);
    
public voidsetProtocol(java.lang.String k)

        setSecure(true);
        setAttribute("protocol", k);
    
public voidsetRestrictedUserAgents(java.lang.String valueS)

 restrictedUserAgents = valueS; 
public voidsetSSLCACertificateFile(java.lang.String SSLCACertificateFile)

 endpoint.setSSLCACertificateFile(SSLCACertificateFile); 
public voidsetSSLCACertificatePath(java.lang.String SSLCACertificatePath)

 endpoint.setSSLCACertificatePath(SSLCACertificatePath); 
public voidsetSSLCARevocationFile(java.lang.String SSLCARevocationFile)

 endpoint.setSSLCARevocationFile(SSLCARevocationFile); 
public voidsetSSLCARevocationPath(java.lang.String SSLCARevocationPath)

 endpoint.setSSLCARevocationPath(SSLCARevocationPath); 
public voidsetSSLCertificateChainFile(java.lang.String SSLCertificateChainFile)

 endpoint.setSSLCertificateChainFile(SSLCertificateChainFile); 
public voidsetSSLCertificateFile(java.lang.String SSLCertificateFile)

 endpoint.setSSLCertificateFile(SSLCertificateFile); 
public voidsetSSLCertificateKeyFile(java.lang.String SSLCertificateKeyFile)

 endpoint.setSSLCertificateKeyFile(SSLCertificateKeyFile); 
public voidsetSSLCipherSuite(java.lang.String SSLCipherSuite)

 endpoint.setSSLCipherSuite(SSLCipherSuite); 
public voidsetSSLEnabled(boolean SSLEnabled)

 endpoint.setSSLEnabled(SSLEnabled); 
public voidsetSSLPassword(java.lang.String SSLPassword)

 endpoint.setSSLPassword(SSLPassword); 
public voidsetSSLProtocol(java.lang.String SSLProtocol)

 endpoint.setSSLProtocol(SSLProtocol); 
public voidsetSSLVerifyClient(java.lang.String SSLVerifyClient)

 endpoint.setSSLVerifyClient(SSLVerifyClient); 
public voidsetSSLVerifyDepth(int SSLVerifyDepth)

 endpoint.setSSLVerifyDepth(SSLVerifyDepth); 
public voidsetSecure(boolean b)

 secure = b; 
public voidsetSendfileSize(int sendfileSize)

 endpoint.setSendfileSize(sendfileSize); 
public voidsetServer(java.lang.String server)

 this.server = server; 
public voidsetSoLinger(int soLinger)

 endpoint.setSoLinger(soLinger); 
public voidsetSoTimeout(int soTimeout)

 endpoint.setSoTimeout(soTimeout); 
public voidsetSocketBuffer(int socketBuffer)

 this.socketBuffer = socketBuffer; 
public voidsetTcpNoDelay(boolean tcpNoDelay)

 endpoint.setTcpNoDelay(tcpNoDelay); 
public voidsetThreadPriority(int threadPriority)

 endpoint.setThreadPriority(threadPriority); 
public voidsetTimeout(int timeout)

 this.timeout = timeout; 
public voidsetUseSendfile(boolean useSendfile)

 endpoint.setUseSendfile(useSendfile); 
public voidstart()

        if( this.domain != null ) {
            try {
                tpOname=new ObjectName
                    (domain + ":" + "type=ThreadPool,name=" + getName());
                Registry.getRegistry(null, null)
                .registerComponent(endpoint, tpOname, null );
            } catch (Exception e) {
                log.error("Can't register threadpool" );
            }
            rgOname=new ObjectName
                (domain + ":type=GlobalRequestProcessor,name=" + getName());
            Registry.getRegistry(null, null).registerComponent
                ( cHandler.global, rgOname, null );
        }

        try {
            endpoint.start();
        } catch (Exception ex) {
            log.error(sm.getString("http11protocol.endpoint.starterror"), ex);
            throw ex;
        }
        if(log.isInfoEnabled())
            log.info(sm.getString("http11protocol.start", getName()));