remm        2003/07/28 04:19:11

  Modified:    catalina/src/share/org/apache/coyote/tomcat5
                        CoyoteConnector.java
  Log:
  - Add a new protocol attribute, which can be used rather than using the
    protocol handler classname (I am trying to beautify a bit the default
    configuration).
  
  Revision  Changes    Path
  1.16      +40 -3     
jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteConnector.java
  
  Index: CoyoteConnector.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteConnector.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- CoyoteConnector.java      27 Jul 2003 17:50:35 -0000      1.15
  +++ CoyoteConnector.java      28 Jul 2003 11:19:11 -0000      1.16
  @@ -824,6 +824,44 @@
   
   
       /**
  +     * Return the Coyote protocol handler in use.
  +     */
  +    public String getProtocol() {
  +
  +        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;
  +
  +    }
  +
  +
  +    /**
  +     * Set the Coyote protocol which will be used
  +     * by the connector.
  +     *
  +     * @param protocolHandlerClassName The new class name
  +     */
  +    public void setProtocol(String protocol) {
  +
  +        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);
  +        }
  +
  +    }
  +
  +
  +    /**
        * Return the class name of the Coyote protocol handler in use.
        */
       public String getProtocolHandlerClassName() {
  @@ -1257,7 +1295,6 @@
               Class clazz = Class.forName(protocolHandlerClassName);
               protocolHandler = (ProtocolHandler) clazz.newInstance();
           } catch (Exception e) {
  -            e.printStackTrace();
               throw new LifecycleException
                   (sm.getString
                    ("coyoteConnector.protocolHandlerInstantiationFailed", e));
  @@ -1308,7 +1345,7 @@
           Iterator keys = properties.keySet().iterator();
           while( keys.hasNext() ) {
               String name = (String)keys.next();
  -            String value = properties.get(name).toString(); 
  +            String value = properties.get(name).toString();
               IntrospectionUtils.setProperty(protocolHandler, name, value);
           }
           
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to