FileDocCategorySizeDatePackage
CoyoteConnector.javaAPI DocGlassfish v2 API58889Mon Jul 09 13:46:46 BST 2007org.apache.coyote.tomcat5

CoyoteConnector

public class CoyoteConnector extends Object implements org.apache.catalina.Connector, org.apache.catalina.Lifecycle, MBeanRegistration
Implementation of a Coyote connector for Tomcat 5.x.
author
Craig R. McClanahan
author
Remy Maucherat
version
$Revision: 1.23 $ $Date: 2007/07/09 20:46:45 $

Fields Summary
private static com.sun.org.apache.commons.logging.Log
log
private String
defaultClassName
Coyote Adapter class name. Defaults to the CoyoteAdapter.
private HashMap
properties
Holder for our configured properties.
private org.apache.catalina.Service
service
The Service we are associated with (if any).
private int
acceptCount
The accept count for this Connector.
private String
address
The IP address on which to bind, if any. If null, all addresses on the server will be bound.
private boolean
allowTrace
Do we allow TRACE ?
private int
bufferSize
The input buffer size we should create on input streams.
protected org.apache.catalina.Container
container
The Container used for processing requests received by this Connector.
private String
compression
Compression value.
private int
debug
The debugging detail level for this component.
private boolean
enableLookups
The "enable DNS lookups" flag for this Connector.
private org.apache.catalina.net.ServerSocketFactory
factory
The server socket factory for this component.
private int
maxHttpHeaderSize
Maximum size of a HTTP header. 4KB is the default.
private boolean
xpoweredBy
private static final String
info
Descriptive information about this Connector implementation.
protected org.apache.catalina.util.LifecycleSupport
lifecycle
The lifecycle event support for this component.
protected int
minProcessors
The minimum number of processors to start at initialization time.
private int
maxProcessors
The maximum number of processors allowed, or <0 for unlimited.
private int
connectionLinger
Linger value on the incoming connection. Note : a value inferior to 0 means no linger.
private int
connectionTimeout
Timeout value on the incoming connection. Note : a value of 0 means no timeout.
private int
connectionUploadTimeout
Timeout value on the incoming connection during request processing. Note : a value of 0 means no timeout.
private int
serverSocketTimeout
Timeout value on the server socket. Note : a value of 0 means no timeout.
private int
port
The port number on which we listen for requests.
private String
proxyName
The server name to which we should pretend requests to this Connector were directed. This is useful when operating Tomcat behind a proxy server, so that redirects get constructed accurately. If not specified, the server name included in the Host header is used.
private int
proxyPort
The server port to which we should pretent requests to this Connector were directed. This is useful when operating Tomcat behind a proxy server, so that redirects get constructed accurately. If not specified, the port number specified by the port property is used.
private int
redirectPort
The redirect port for non-SSL to SSL redirects.
private String
defaultHost
The default host.
private String
scheme
The request scheme that will be set on all requests received through this connector.
private boolean
secure
The secure connection flag that will be set on all requests received through this connector.
private boolean
blocking
The blocking connection flag that will be set on all requests received through this connector.
private boolean
tomcatAuthentication
For jk, do tomcat authentication if true, trust server if false
private org.apache.catalina.util.StringManager
sm
The string manager for this package.
private boolean
disableUploadTimeout
Flag to disable setting a seperate time-out for uploads. If true, then the timeout parameter is ignored. If false, then the timeout parameter is used to control uploads.
private int
maxKeepAliveRequests
Maximum number of Keep-Alive requests to honor per connection.
private int
maxPostSize
Maximum size of a POST which will be automatically parsed by the container. 2MB by default.
protected boolean
initialized
Has this component been initialized yet?
private boolean
started
Has this component been started yet?
private boolean
stopped
The shutdown signal to our background thread
private Thread
thread
The background thread.
private boolean
tcpNoDelay
Use TCP no delay ?
private String
protocolHandlerClassName
Coyote Protocol handler class name. Defaults to the Coyote HTTP/1.1 protocolHandler.
private org.apache.coyote.ProtocolHandler
protocolHandler
Coyote protocol handler.
private org.apache.coyote.Adapter
adapter
Coyote adapter.
private org.apache.tomcat.util.http.mapper.Mapper
mapper
Mapper.
protected MapperListener
mapperListener
Mapper listener.
private String
uriEncoding
URI encoding.
private boolean
isEnabled
protected boolean
authPassthroughEnabled
Flag indicating whether this connector is receiving its requests from a trusted intermediate server
protected com.sun.appserv.ProxyHandler
proxyHandler
private String
selectorThreadImpl
The SelectorThread implementation class.
protected String
domain
protected ObjectName
oname
protected MBeanServer
mserver
ObjectName
controller
Constructors Summary
Methods Summary
public voidaddLifecycleListener(org.apache.catalina.LifecycleListener listener)
Add a lifecycle event listener to this component.

param
listener The listener to add


        lifecycle.addLifecycleListener(listener);

    
public org.apache.catalina.RequestcreateRequest()
Create (or allocate) and return a Request object suitable for specifying the contents of a Request to the responsible Container.


        CoyoteRequest request = new CoyoteRequest();
        request.setConnector(this);
        return (request);

    
public org.apache.catalina.ResponsecreateResponse()
Create (or allocate) and return a Response object suitable for receiving the contents of a Response from the responsible Container.


        CoyoteResponse response = new CoyoteResponse();
        response.setConnector(this);
        return (response);

    
public voiddestroy()

        if( oname!=null && controller==oname ) {
            if (log.isDebugEnabled()) {
                log.debug("Unregister itself " + oname );
            }
            Registry.getRegistry().unregisterComponent(oname);
        }
        if( getService() == null)
            return;
        getService().removeConnector(this);
    
private voidfindContainer()

        try {
            // Register to the service
            ObjectName parentName=new ObjectName( domain + ":" +
                    "type=Service");
            
            if (log.isDebugEnabled()) {
                log.debug("Adding to " + parentName );
            }
            if( mserver.isRegistered(parentName )) {
                mserver.invoke(parentName, "addConnector", new Object[] { this },
                        new String[] {"org.apache.catalina.Connector"});
                // As a side effect we'll get the container field set
                // Also initialize will be called
                //return;
            }
            // XXX Go directly to the Engine
            // initialize(); - is called by addConnector
            ObjectName engName=new ObjectName( domain + ":" + "type=Engine");
            if( mserver.isRegistered(engName )) {
                Object obj=mserver.getAttribute(engName, "managedResource");
                if (log.isDebugEnabled()) {
                    log.debug("Found engine " + obj + " " + obj.getClass());
                }
                container=(Container)obj;
                
                // Internal initialize - we now have the Engine
                initialize();
                
                if (log.isDebugEnabled()) {
                    log.debug("Initialized");
                }
                // As a side effect we'll get the container field set
                // Also initialize will be called
                return;
            }
        } catch( Exception ex ) {
            log.error( "Error finding container " + ex);
        }
    
public org.apache.catalina.LifecycleListener[]findLifecycleListeners()
Get the lifecycle listeners associated with this lifecycle. If this Lifecycle has no listeners registered, a zero-length array is returned.


        return null;//lifecycle.findLifecycleListeners();

    
public intgetAcceptCount()
Return the accept count for this Connector.


        return (acceptCount);

    
public org.apache.coyote.AdaptergetAdapter()
Get the Adapter used by this connector.

        return adapter;
    
public java.lang.StringgetAddress()
Return the bind IP address for this Connector.


        return (this.address);

    
public booleangetAllowTrace()
True if the TRACE method is allowed. Default value is "false".

                                                                           
        return (this.allowTrace);
                                                                           
    
public booleangetAuthPassthroughEnabled()
Returns the value of this connector's authPassthroughEnabled flag.

return
true if this connector is receiving its requests from a trusted intermediate server, false otherwise

        return this.authPassthroughEnabled;
    
public booleangetBlocking()
Return the blocking connection flag that will be assigned to requests received through this connector. Default value is "false".

        return (this.blocking);
    
public intgetBufferSize()
Return the input buffer size for this Connector.


        return (this.bufferSize);

    
public java.security.cert.X509Certificate[]getCertificates(org.apache.catalina.Request request)
Get the underlying WebContainer certificate for the request

        
        CoyoteRequest cRequest = null;
        if (request instanceof CoyoteRequest) {
            cRequest=(CoyoteRequest) request;
        } else {
            return null;
        }
        
        X509Certificate certs[] = (X509Certificate[])
        cRequest.getAttribute(Globals.CERTIFICATES_ATTR);
        if ((certs == null) || (certs.length < 1)) {
            certs = (X509Certificate[])
            cRequest.getAttribute(Globals.SSL_CERTIFICATE_ATTR);
        }
        return certs;
    
public java.lang.StringgetCiphers()
Gets the list of SSL cipher suites that are to be enabled

return
Comma-separated list of SSL cipher suites, or null if all cipher suites supported by the underlying SSL implementation are being enabled

        String ret = (String) getProperty("ciphers");
        if (ret == null) {
            ServerSocketFactory factory = getFactory();
            if (factory instanceof CoyoteServerSocketFactory) {
                ret = ((CoyoteServerSocketFactory)factory).getCiphers();
            }
        }

        return ret;
    
public booleangetClientAuth()

        boolean ret = false;

        String prop = (String) getProperty("clientauth");
        if (prop != null) {
            ret = Boolean.valueOf(prop).booleanValue();
        } else {	
            ServerSocketFactory factory = this.getFactory();
            if (factory instanceof CoyoteServerSocketFactory) {
                ret = ((CoyoteServerSocketFactory)factory).getClientAuth();
            }
        }

        return ret;
    
public java.lang.StringgetCompression()
Get the value of compression.


        return (compression);

    
public intgetConnectionLinger()
Return the connection linger for this Connector.


        return (connectionLinger);

    
public intgetConnectionTimeout()
Return the connection timeout for this Connector.


        return (connectionTimeout);

    
public intgetConnectionUploadTimeout()
Return the connection upload timeout for this Connector.


        return (connectionUploadTimeout);

    
public org.apache.catalina.ContainergetContainer()
Return the Container used for processing requests received by this Connector.

        if( container==null ) {
            // Lazy - maybe it was added later
            findContainer();     
        }
        return (container);

    
public javax.management.ObjectNamegetController()

        return controller;
    
public intgetDebug()
Return the debugging detail level for this component.


        return (debug);

    
public java.lang.StringgetDefaultHost()
Gets the default host of this Connector.

return
The default host of this Connector

        return this.defaultHost;
    
public booleangetDisableUploadTimeout()
Return the flag that specifies upload time-out behavior.

        return disableUploadTimeout;
    
public java.lang.StringgetDomain()

        return domain;
    
public booleangetEnableLookups()
Return the "enable DNS lookups" flag.


        return (this.enableLookups);

    
public org.apache.catalina.net.ServerSocketFactorygetFactory()
Return the server socket factory used by this Container.


        return (this.factory);

    
public java.lang.StringgetInfo()
Return descriptive information about this Connector implementation.


        return (info);

    
public booleangetKeepAlive()
Return the Keep-Alive policy for the connection.

        return ((maxKeepAliveRequests != 0) && (maxKeepAliveRequests != 1));
    
public java.lang.StringgetKeyAlias()
Gets the alias name of the keypair and supporting certificate chain used by this Connector to authenticate itself to SSL clients.

return
The alias name of the keypair and supporting certificate chain

        String ret = (String) getProperty("keyAlias");
        if (ret == null) {
            ServerSocketFactory factory = getFactory();
            if (factory instanceof CoyoteServerSocketFactory) {
                ret = ((CoyoteServerSocketFactory)factory).getKeyAlias();
            }
        }

        return ret;
    
public java.lang.StringgetKeystoreFile()

        String ret = (String) getProperty("keystore");
        if (ret == null) {
            ServerSocketFactory factory = this.getFactory();
            if (factory instanceof CoyoteServerSocketFactory) {
                ret = ((CoyoteServerSocketFactory)factory).getKeystoreFile();
            }
        }

        return ret;
    
public java.lang.StringgetKeystorePass()
Return keystorePass

        String ret = (String) getProperty("keypass");
        if (ret == null) {
            ServerSocketFactory factory = getFactory();
            if (factory instanceof CoyoteServerSocketFactory ) {
                return ((CoyoteServerSocketFactory)factory).getKeystorePass();
            }
        }

        return ret;
    
public org.apache.tomcat.util.http.mapper.MappergetMapper()
Return the mapper.


         return (mapper);

     
public intgetMaxHttpHeaderSize()
Return the maximum HTTP header size.

      return maxHttpHeaderSize;
    
public intgetMaxKeepAliveRequests()
Return the maximum number of Keep-Alive requests to honor per connection.

        return maxKeepAliveRequests;
    
public intgetMaxPostSize()
Return the maximum size of a POST which will be automatically parsed by the container.


        return (maxPostSize);

    
public intgetMaxProcessors()
Return the maximum number of processors allowed, or <0 for unlimited.


        return (maxProcessors);

    
public intgetMinProcessors()
Return the minimum number of processors to start at initialization.


        return (minProcessors);

    
public javax.management.ObjectNamegetObjectName()

        return oname;
    
public intgetPort()
Return the port number on which we listen for requests.


        return (this.port);

    
public java.lang.ObjectgetProperty(java.lang.String name)
Return a configured property.

 
    
    
    // ------------------------------------------------------------- Properties

             
        
        return properties.get(name);
    
public java.lang.StringgetProtocol()
Return the Coyote protocol handler in use.


        if ("org.apache.coyote.http11.Http11Protocol".equals
            (getProtocolHandlerClassName())) {
            return "HTTP/1.1";
        } else if ("org.apache.jk.server.JkCoyoteHandler".equals
                   (getProtocolHandlerClassName())) {
            return "AJP/1.3";
        }
        return null;

    
public org.apache.coyote.ProtocolHandlergetProtocolHandler()
Return the protocol handler associated with the connector.


        return (this.protocolHandler);

    
public java.lang.StringgetProtocolHandlerClassName()
Return the class name of the Coyote protocol handler in use.


        return (this.protocolHandlerClassName);

    
public com.sun.appserv.ProxyHandlergetProxyHandler()
Gets the ProxyHandler instance associated with this CoyoteConnector.

return
ProxyHandler instance associated with this CoyoteConnector, or null

        return proxyHandler;
    
public java.lang.StringgetProxyName()
Return the proxy server name for this Connector.


        return (this.proxyName);

    
public intgetProxyPort()
Return the proxy server port for this Connector.


        return (this.proxyPort);

    
public intgetRedirectPort()
Return the port number to which a request should be redirected if it comes in on a non-SSL port and is subject to a security constraint with a transport guarantee that requires SSL.


        return (this.redirectPort);

    
public java.lang.StringgetScheme()
Return the scheme that will be assigned to requests received through this connector. Default value is "http".


        return (this.scheme);

    
public booleangetSecure()
Return the secure connection flag that will be assigned to requests received through this connector. Default value is "false".


        return (this.secure);

    
public java.lang.StringgetSelectorThreadImpl()
Get the underlying SelectorThread implementation, null if the default is used.

        return selectorThreadImpl;
    
public intgetServerSocketTimeout()
Return the server socket timeout for this Connector.


        return (serverSocketTimeout);

    
public org.apache.catalina.ServicegetService()
Return the Service with which we are associated (if any).


        return (this.service);

    
public java.lang.StringgetSslProtocol()
Gets the SSL protocol variant to be used.

return
SSL protocol variant

        String ret = (String) getProperty("sslProtocol");
        if (ret == null) {
            ServerSocketFactory factory = getFactory();
            if (factory instanceof CoyoteServerSocketFactory) {
                ret = ((CoyoteServerSocketFactory)factory).getProtocol();
            }
        }

        return ret;
    
public java.lang.StringgetSslProtocols()
Gets the SSL protocol variants to be enabled.

return
Comma-separated list of SSL protocol variants

        String ret = (String) getProperty("sslProtocols");
        if (ret == null) {
            ServerSocketFactory factory = getFactory();
            if (factory instanceof CoyoteServerSocketFactory) {
                ret = ((CoyoteServerSocketFactory)factory).getProtocols();
            }
        }

        return ret;
    
public booleangetTcpNoDelay()
Return the TCP no delay flag value.


        return (this.tcpNoDelay);

    
public booleangetTomcatAuthentication()

        return tomcatAuthentication;
    
public java.lang.StringgetURIEncoding()
Return the character encoding to be used for the URI.


        return (this.uriEncoding);

    
public voidinit()


        if( this.getService() != null ) {
            if (log.isDebugEnabled()) {
                log.debug( "Already configured" );
            }
            return;
        }
        if( container==null ) {
            findContainer();
        }
    
public voidinitialize()
Initialize this connector (create ServerSocket here!)

        if (initialized) {
            log.info(sm.getString("coyoteConnector.alreadyInitialized"));
            return;
        }

        this.initialized = true;

        if( oname == null && (container instanceof StandardEngine)) {
            try {
                // we are loaded directly, via API - and no name was given to us
                StandardEngine cb=(StandardEngine)container;
                String encodedAddr = null;
                if (getAddress() != null) {
                    encodedAddr = URLEncoder.encode(getAddress());
                }
                String addSuffix=(getAddress()==null) ?"": ",address=" + encodedAddr;
                oname=new ObjectName(cb.getName() + ":type=Connector,port="+
                        getPort() + addSuffix);
                Registry.getRegistry().registerComponent(this, oname, null);
                controller=oname;
            } catch (Exception e) {
                log.error( "Error registering connector ", e);
            }
            if (log.isDebugEnabled()) {
                log.debug("Creating name for connector " + oname);
            }
        }
        

        //START SJSAS 6363251
        // Initializa adapter
        //adapter = new CoyoteAdapter(this);
        //END SJSAS 6363251
        // Instantiate Adapter
        //START SJSAS 6363251
        if ( adapter == null){
            try {
                Class clazz = Class.forName(defaultClassName);
                Constructor constructor = 
                        clazz.getConstructor(new Class[]{CoyoteConnector.class});
                adapter = 
                        (Adapter)constructor.newInstance(new Object[]{this});
            } catch (Exception e) {
                throw new LifecycleException
                    (sm.getString
                     ("coyoteConnector.adapterClassInstantiationFailed", e));
            } 
        }
        //END SJSAS 6363251

        // Instantiate protocol handler
        if ( protocolHandler == null ) {
            try {
                Class clazz = Class.forName(protocolHandlerClassName);
             
                // use no-arg constructor for JkCoyoteHandler
                if (protocolHandlerClassName.equals("org.apache.jk.server.JkCoyoteHandler")) {
                    protocolHandler = (ProtocolHandler) clazz.newInstance();
                    if (adapter instanceof CoyoteAdapter){
                        ((CoyoteAdapter)adapter).setCompatWithTomcat(true);
                    } else {
                        throw new IllegalStateException
                          (sm.getString
                            ("coyoteConnector.illegalAdapter",adapter));
                    }
                // START SJSAS 6439313
                } else {
                    Constructor constructor = 
                            clazz.getConstructor(new Class[]{Boolean.TYPE,
                                                             Boolean.TYPE,
                                                             String.class});

                    protocolHandler = (ProtocolHandler) 
                        constructor.newInstance(secure, blocking,
                                                selectorThreadImpl);
                // END SJSAS 6439313
                }
            } catch (Exception e) {
                throw new LifecycleException
                    (sm.getString
                     ("coyoteConnector.protocolHandlerInstantiationFailed", e));
            }
        }

        protocolHandler.setAdapter(adapter);

        IntrospectionUtils.setProperty(protocolHandler, "jkHome",
                                       System.getProperty("catalina.base"));

        // Configure secure socket factory
        // XXX For backwards compatibility only.
        if (factory instanceof CoyoteServerSocketFactory) {
            IntrospectionUtils.setProperty(protocolHandler, "secure",
                                           "" + true);
            CoyoteServerSocketFactory ssf =
                (CoyoteServerSocketFactory) factory;
            IntrospectionUtils.setProperty(protocolHandler, "algorithm",
                                           ssf.getAlgorithm());
            if (ssf.getClientAuth()) {
                IntrospectionUtils.setProperty(protocolHandler, "clientauth",
                                               "" + ssf.getClientAuth());
            }
            IntrospectionUtils.setProperty(protocolHandler, "keystore",
                                           ssf.getKeystoreFile());
            IntrospectionUtils.setProperty(protocolHandler, "randomfile",
                                           ssf.getRandomFile());
            IntrospectionUtils.setProperty(protocolHandler, "rootfile",
                                           ssf.getRootFile());

            IntrospectionUtils.setProperty(protocolHandler, "keypass",
                                           ssf.getKeystorePass());
            IntrospectionUtils.setProperty(protocolHandler, "keytype",
                                           ssf.getKeystoreType());
            IntrospectionUtils.setProperty(protocolHandler, "protocol",
                                           ssf.getProtocol());
            IntrospectionUtils.setProperty(protocolHandler, "protocols",
                                           ssf.getProtocols());
            IntrospectionUtils.setProperty(protocolHandler,
                                           "sSLImplementation",
                                           ssf.getSSLImplementation());
            IntrospectionUtils.setProperty(protocolHandler, "ciphers",
                                           ssf.getCiphers());
            IntrospectionUtils.setProperty(protocolHandler, "keyAlias",
                                           ssf.getKeyAlias());
        } else {
            IntrospectionUtils.setProperty(protocolHandler, "secure",
                                           "" + secure);
        }

        /* Set the configured properties.  This only sets the ones that were
         * explicitly configured.  Default values are the responsibility of
         * the protocolHandler.
         */
        Iterator keys = properties.keySet().iterator();
        while( keys.hasNext() ) {
            String name = (String)keys.next();
            String value = properties.get(name).toString();
	    String trnName = translateAttributeName(name);
            IntrospectionUtils.setProperty(protocolHandler, trnName, value);
        }
        

        try {
            protocolHandler.init();
        } catch (Exception e) {
            throw new LifecycleException
                (sm.getString
                 ("coyoteConnector.protocolHandlerInitializationFailed", e));
        }
    
public booleanisAvailable()
Is this connector available for processing requests?


        return (started);

    
public booleanisEnabled()

        return isEnabled;
    
public booleanisXpoweredBy()
Indicates whether the generation of an X-Powered-By response header for servlet-generated responses is enabled or disabled for this Connector.

return
true if generation of X-Powered-By response header is enabled, false otherwise

        return xpoweredBy;
    
private voidlog(java.lang.String message)
Log a message on the Logger associated with our Container (if any).

param
message Message to be logged


        Logger logger = container.getLogger();
        String localName = "CoyoteConnector";
        if (logger != null)
            logger.log(localName + " " + message);
        else
            System.out.println(localName + " " + message);

    
private voidlog(java.lang.String message, java.lang.Throwable throwable)
Log a message on the Logger associated with our Container (if any).

param
message Message to be logged
param
throwable Associated exception


        Logger logger = container.getLogger();
        String localName = "CoyoteConnector";
        if (logger != null)
            logger.log(localName + " " + message, throwable);
        else {
            System.out.println(localName + " " + message);
            throwable.printStackTrace(System.out);
        }

    
public voidpostDeregister()

        try {
            if( started ) {
                stop();
            }
        } catch( Throwable t ) {
            log.error( "Unregistering - can't stop", t);
        }
    
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 voidremoveLifecycleListener(org.apache.catalina.LifecycleListener listener)
Remove a lifecycle event listener from this component.

param
listener The listener to add


        lifecycle.removeLifecycleListener(listener);

    
public voidremoveProperty(java.lang.String name)
remove a configured property.

        properties.remove(name);
    
public voidsetAcceptCount(int count)
Set the accept count for this Connector.

param
count The new accept count


        this.acceptCount = count;
        setProperty("backlog", String.valueOf(count));

    
public voidsetAdapter(org.apache.coyote.Adapter adapter)
Set the Adapter used by this connector.

        this.adapter = adapter;
    
public voidsetAddress(java.lang.String address)
Set the bind IP address for this Connector.

param
address The bind IP address


        this.address = address;
        setProperty("address", address);

    
public voidsetAllowTrace(boolean allowTrace)
Set the allowTrace flag, to disable or enable the TRACE HTTP method. *

param
allowTrace The new allowTrace flag

                                                                           
        this.allowTrace = allowTrace;
        setProperty("allowTrace", String.valueOf(allowTrace));
                                                                           
    
public voidsetAuthPassthroughEnabled(boolean authPassthroughEnabled)
Sets the value of this connector's authPassthroughEnabled flag.

param
authPassthroughEnabled true if this connector is receiving its requests from a trusted intermediate server, false otherwise

        this.authPassthroughEnabled = authPassthroughEnabled;
    
public voidsetBlocking(boolean blocking)
Set the blocking connection flag that will be assigned to requests received through this connector.

param
blocking The new blocking connection flag


        this.blocking = blocking;
        setProperty("blocking", String.valueOf(blocking));

    
public voidsetBufferSize(int bufferSize)
Set the input buffer size for this Connector.

param
bufferSize The new input buffer size.


        this.bufferSize = bufferSize;
        setProperty("bufferSize", String.valueOf(bufferSize));

    
public voidsetCiphers(java.lang.String ciphers)
Sets the SSL cipher suites that are to be enabled. Only those SSL cipher suites that are actually supported by the underlying SSL implementation will be enabled.

param
ciphers Comma-separated list of SSL cipher suites

        setProperty("ciphers", ciphers);
        ServerSocketFactory factory = getFactory();
        if (factory instanceof CoyoteServerSocketFactory) {
            ((CoyoteServerSocketFactory)factory).setCiphers(ciphers);
        }
    
public voidsetClientAuth(boolean clientAuth)

        setProperty("clientauth", String.valueOf(clientAuth));
        ServerSocketFactory factory = this.getFactory();
        if (factory instanceof CoyoteServerSocketFactory) {
            ((CoyoteServerSocketFactory)factory).setClientAuth(clientAuth);
        }
    
public voidsetCompression(java.lang.String compression)
Set the value of compression.

param
compression The new compression value, which can be "on", "off" or "force"


        this.compression = compression;
        setProperty("compression", compression);

    
public voidsetConnectionLinger(int connectionLinger)
Set the connection linger for this Connector.

param
count The new connection linge


        this.connectionLinger = connectionLinger;
        setProperty("soLinger", String.valueOf(connectionLinger));

    
public voidsetConnectionTimeout(int connectionTimeout)
Set the connection timeout for this Connector.

param
count The new connection timeout


        this.connectionTimeout = connectionTimeout;
        setProperty("soTimeout", String.valueOf(connectionTimeout));

    
public voidsetConnectionUploadTimeout(int connectionUploadTimeout)
Set the connection upload timeout for this Connector.

param
connectionUploadTimeout The new connection upload timeout


        this.connectionUploadTimeout = connectionUploadTimeout;
        setProperty("timeout", String.valueOf(connectionUploadTimeout));

    
public voidsetContainer(org.apache.catalina.Container container)
Set the Container used for processing requests received by this Connector.

param
container The new Container to use


        this.container = container;

    
public voidsetController(javax.management.ObjectName controller)

        this.controller = controller;
    
public voidsetDebug(int debug)
Set the debugging detail level for this component.

param
debug The new debugging detail level


        this.debug = debug;

    
public voidsetDefaultHost(java.lang.String defaultHost)
Sets the default host for this Connector.

param
defaultHost The default host for this Connector

        this.defaultHost = defaultHost;
    
public voidsetDisableUploadTimeout(boolean isDisabled)
Set the flag to specify upload time-out behavior.

param
isDisabled If true, then the timeout parameter is ignored. If false, then the timeout parameter is used to control uploads.

        disableUploadTimeout = isDisabled;
        setProperty("disableUploadTimeout", String.valueOf(isDisabled));
    
public voidsetEnableLookups(boolean enableLookups)
Set the "enable DNS lookups" flag.

param
enableLookups The new "enable DNS lookups" flag value


        this.enableLookups = enableLookups;
        setProperty("enableLookups", String.valueOf(enableLookups));

    
public voidsetFactory(org.apache.catalina.net.ServerSocketFactory factory)
Set the server socket factory used by this Container.

param
factory The new server socket factory


        this.factory = factory;

    
public voidsetIsEnabled(boolean isEnabled)

        this.isEnabled = isEnabled;
    
public voidsetKeepAlive(boolean keepAlive)
Set the keep-alive policy for this connection.

        if (!keepAlive) {
            setMaxKeepAliveRequests(1);
        }
    
public voidsetKeyAlias(java.lang.String alias)
Sets the alias name of the keypair and supporting certificate chain used by this Connector to authenticate itself to SSL clients.

param
alias The alias name of the keypair and supporting certificate chain

        setProperty("keyAlias", alias);
        ServerSocketFactory factory = getFactory();
        if (factory instanceof CoyoteServerSocketFactory) {
            ((CoyoteServerSocketFactory)factory).setKeyAlias(alias);
        }
    
public voidsetKeystoreFile(java.lang.String keystoreFile)

        setProperty("keystore", keystoreFile);
        ServerSocketFactory factory = this.getFactory();
        if (factory instanceof CoyoteServerSocketFactory) {
            ((CoyoteServerSocketFactory)factory).setKeystoreFile(keystoreFile);
        }
    
public voidsetKeystorePass(java.lang.String keystorePass)
Set keystorePass

        setProperty("keypass", keystorePass);
        ServerSocketFactory factory = getFactory();
        if( factory instanceof CoyoteServerSocketFactory ) {
            ((CoyoteServerSocketFactory)factory).setKeystorePass(keystorePass);
        }
    
public voidsetMaxHttpHeaderSize(int size)
Set the maximum HTTP header size.

        maxHttpHeaderSize = size;
        setProperty("maxHttpHeaderSize", String.valueOf(size));
    
public voidsetMaxKeepAliveRequests(int mkar)
Set the maximum number of Keep-Alive requests to honor per connection.

        maxKeepAliveRequests = mkar;
        setProperty("maxKeepAliveRequests", String.valueOf(mkar));
    
public voidsetMaxPostSize(int maxPostSize)
Set the maximum size of a POST which will be automatically parsed by the container.

param
maxPostSize The new maximum size in bytes of a POST which will be automatically parsed by the container


        this.maxPostSize = maxPostSize;
        setProperty("maxPostSize", String.valueOf(maxPostSize));
    
public voidsetMaxProcessors(int maxProcessors)
Set the maximum number of processors allowed, or <0 for unlimited.

param
maxProcessors The new maximum processors


        this.maxProcessors = maxProcessors;
        setProperty("maxThreads", String.valueOf(maxProcessors));

    
public voidsetMinProcessors(int minProcessors)
Set the minimum number of processors to start at initialization.

param
minProcessors The new minimum processors


        this.minProcessors = minProcessors;
        setProperty("minThreads", String.valueOf(minProcessors));

    
public voidsetPort(int port)
Set the port number on which we listen for requests.

param
port The new port number


        this.port = port;
        setProperty("port", String.valueOf(port));

    
public voidsetProperty(java.lang.String name, java.lang.Object value)
Set a configured property.

        properties.put(name, value);
    
public voidsetProtocol(java.lang.String protocol)
Set the Coyote protocol which will be used by the connector.

param
protocol The Coyote protocol name


        if (protocol.equals("HTTP/1.1")) {
            setProtocolHandlerClassName
                ("org.apache.coyote.http11.Http11Protocol");
        } else if (protocol.equals("AJP/1.3")) {
            setProtocolHandlerClassName
                ("org.apache.jk.server.JkCoyoteHandler");
        } else {
            setProtocolHandlerClassName(null);
        }

    
public voidsetProtocolHandler(org.apache.coyote.ProtocolHandler protocolHandler)
Set the ProtocolHandler used by this connector.

        this.protocolHandler = protocolHandler;
    
public voidsetProtocolHandlerClassName(java.lang.String protocolHandlerClassName)
Set the class name of the Coyote protocol handler which will be used by the connector.

param
protocolHandlerClassName The new class name


        this.protocolHandlerClassName = protocolHandlerClassName;

    
public voidsetProxyHandler(com.sun.appserv.ProxyHandler proxyHandler)
Sets the ProxyHandler implementation for this CoyoteConnector to use.

param
proxyHandler ProxyHandler instance to use

        this.proxyHandler = proxyHandler;
    
public voidsetProxyName(java.lang.String proxyName)
Set the proxy server name for this Connector.

param
proxyName The new proxy server name


        if(proxyName != null && proxyName.length() > 0) {
            this.proxyName = proxyName;
            setProperty("proxyName", proxyName);
        } else {
            this.proxyName = null;
            removeProperty("proxyName");
        }

    
public voidsetProxyPort(int proxyPort)
Set the proxy server port for this Connector.

param
proxyPort The new proxy server port


        this.proxyPort = proxyPort;
        setProperty("proxyPort", String.valueOf(proxyPort));

    
public voidsetRedirectPort(int redirectPort)
Set the redirect port number.

param
redirectPort The redirect port number (non-SSL to SSL)


        this.redirectPort = redirectPort;
        setProperty("redirectPort", String.valueOf(redirectPort));

    
public voidsetSSL3SessionTimeout(java.lang.String timeout)
Sets the number of seconds after which SSL3 sessions expire and are removed from the SSL sessions cache.

        setProperty("ssl3SessionTimeout", timeout);
    
public voidsetSSLSessionCacheSize(java.lang.String cacheSize)
Sets the number of SSL sessions that may be cached

        setProperty("sslSessionCacheSize", cacheSize);
    
public voidsetSSLSessionTimeout(java.lang.String timeout)
Sets the number of seconds after which SSL sessions expire and are removed from the SSL sessions cache.

        setProperty("sslSessionTimeout", timeout);
    
public voidsetScheme(java.lang.String scheme)
Set the scheme that will be assigned to requests received through this connector.

param
scheme The new scheme


        this.scheme = scheme;
        setProperty("scheme", scheme);

    
public voidsetSecure(boolean secure)
Set the secure connection flag that will be assigned to requests received through this connector.

param
secure The new secure connection flag


        this.secure = secure;
        setProperty("secure", String.valueOf(secure));

    
public voidsetSelectorThreadImpl(java.lang.String selectorThreadImpl)
Set the underlying SelectorThread implementation

        this.selectorThreadImpl = selectorThreadImpl;
    
public voidsetServerSocketTimeout(int serverSocketTimeout)
Set the server socket timeout for this Connector.

param
connectionUploadTimeout The new server socket timeout


        this.serverSocketTimeout = serverSocketTimeout;
        setProperty("serverSoTimeout", String.valueOf(serverSocketTimeout));

    
public voidsetService(org.apache.catalina.Service service)
Set the Service with which we are associated (if any).

param
service The service that owns this Engine


        this.service = service;
        setProperty("service", service);

    
public voidsetSslProtocol(java.lang.String sslProtocol)
Sets the SSL protocol variant to be used.

param
sslProtocol SSL protocol variant

        setProperty("sslProtocol", sslProtocol);
        ServerSocketFactory factory = getFactory();
        if (factory instanceof CoyoteServerSocketFactory) {
            ((CoyoteServerSocketFactory)factory).setProtocol(sslProtocol);
        }
    
public voidsetSslProtocols(java.lang.String sslProtocols)
Sets the SSL protocol variants to be enabled.

param
sslProtocols Comma-separated list of SSL protocol variants

        setProperty("sslProtocols", sslProtocols);
        ServerSocketFactory factory = getFactory();
        if (factory instanceof CoyoteServerSocketFactory) {
            ((CoyoteServerSocketFactory)factory).setProtocols(sslProtocols);
        }
    
public voidsetTcpNoDelay(boolean tcpNoDelay)
Set the TCP no delay flag which will be set on the socket after accepting a connection.

param
tcpNoDelay The new TCP no delay flag


        this.tcpNoDelay = tcpNoDelay;
        setProperty("tcpNoDelay", String.valueOf(tcpNoDelay));

    
public voidsetTomcatAuthentication(boolean tomcatAuthentication)

        this.tomcatAuthentication = tomcatAuthentication;
        setProperty("tomcatAuthentication", String.valueOf(tomcatAuthentication));
    
public voidsetURIEncoding(java.lang.String uriEncoding)
Set the URI encoding to be used for the URI.

param
uriEncoding The new URI character encoding.


        this.uriEncoding = uriEncoding;
        setProperty("uRIEncoding", uriEncoding);

    
public voidsetXpoweredBy(boolean xpoweredBy)
Enables or disables the generation of an X-Powered-By header (with value Servlet/2.4) for all servlet-generated responses returned by this Connector.

param
xpoweredBy true if generation of X-Powered-By response header is to be enabled, false otherwise

        this.xpoweredBy = xpoweredBy;
        setProperty("xpoweredBy", String.valueOf(xpoweredBy));
    
public voidstart()
Begin processing requests via this Connector.

exception
LifecycleException if a fatal startup error occurs

        if( !initialized )
            initialize();

        // Validate and update our current state
        if (started) {
            log.info(sm.getString("coyoteConnector.alreadyStarted"));
            return;
        }
        lifecycle.fireLifecycleEvent(START_EVENT, null);
        started = true;

        // We can't register earlier - the JMX registration of this happens
        // in Server.start callback
        if ( this.oname != null ) {
            // We are registred - register the adapter as well.
            try {
                Registry.getRegistry().registerComponent
                    (protocolHandler, this.domain, "protocolHandler",
                     "type=protocolHandler,className="
                     + protocolHandlerClassName);
            } catch (Exception ex) {
                log.error(sm.getString
                          ("coyoteConnector.protocolRegistrationFailed"), ex);
            }
        } else {
            log.info(sm.getString
                     ("coyoteConnector.cannotRegisterProtocol"));
        }

        try {
            protocolHandler.start();
        } catch (Exception e) {
            throw new LifecycleException
                (sm.getString
                 ("coyoteConnector.protocolHandlerStartFailed", e));
        }

        if( this.domain != null ) {
            mapperListener.setDomain( domain );
            // BEGIN S1AS 5000999
            mapperListener.setPort(this.getPort());
            mapperListener.setDefaultHost(this.defaultHost);
            // END S1AS 5000999
            //mapperListener.setEngine( service.getContainer().getName() );
            mapperListener.init();
            try {
                Registry.getRegistry().registerComponent
                        (mapper, this.domain, "Mapper",
                                "type=Mapper");
            } catch (Exception ex) {
                log.error(sm.getString
                        ("coyoteConnector.protocolRegistrationFailed"), ex);
            }
        }
    
public voidstop()
Terminate processing requests via this Connector.

exception
LifecycleException if a fatal shutdown error occurs


        // Validate and update our current state
        if (!started) {
            log.error(sm.getString("coyoteConnector.notStarted"));
            return;

        }
        lifecycle.fireLifecycleEvent(STOP_EVENT, null);
        started = false;

        // START PWC 6393300
        if ( domain != null){
            try {
                Registry.getRegistry().unregisterComponent(new ObjectName(domain,"type", "Mapper"));
                Registry.getRegistry().unregisterComponent(new ObjectName(domain
                        + ":type=protocolHandler,className="
                        + protocolHandlerClassName));
            } catch (MalformedObjectNameException e) {
                log.info( "Error unregistering mapper ", e);
            }
        } 
        // END PWC 6393300

        try {
            protocolHandler.destroy();
        } catch (Exception e) {
            throw new LifecycleException
                (sm.getString
                 ("coyoteConnector.protocolHandlerDestroyFailed", e));
        }

    
private java.lang.StringtranslateAttributeName(java.lang.String name)

	if ("clientAuth".equals(name)) {
	    return "clientauth";
	} else if ("keystoreFile".equals(name)) {
	    return "keystore";
	} else if ("randomFile".equals(name)) {
	    return "randomfile";
	} else if ("rootFile".equals(name)) {
	    return "rootfile";
	} else if ("keystorePass".equals(name)) {
	    return "keypass";
	} else if ("keystoreType".equals(name)) {
	    return "keytype";
	} else if ("sslProtocol".equals(name)) {
	    return "protocol";
	} else if ("sslProtocols".equals(name)) {
	    return "protocols";
	}
	return name;