You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2014/03/28 00:26:29 UTC

[Bug 56327] Adding non HTTP (e.g AJP) connector using MBeans is not possible

https://issues.apache.org/bugzilla/show_bug.cgi?id=56327

--- Comment #1 from kiran <kg...@gmail.com> ---
Original Code

50     public void addConnector(String address, int port, boolean isAjp,
boolean isSSL) throws MBeanException {
51         
52         Service service; 
53         try {
54             service = (Service)getManagedResource();
55         } catch (InstanceNotFoundException e) {
56             throw new MBeanException(e);
57         } catch (RuntimeOperationsException e) {
58             throw new MBeanException(e);
59         } catch (InvalidTargetObjectTypeException e) {
60             throw new MBeanException(e);
61         }
62         
63         Connector connector = new Connector();
64         if ((address!=null) && (address.length()>0)) {
65             connector.setProperty("address", address);
66         }
67         
68         connector.setPort(port);
69         connector.setProtocol(isAjp ? "AJP/1.3" : "HTTP/1.1");
70         connector.setSecure(isSSL);
71         connector.setScheme(isSSL ? "https" : "http");
72 
73         service.addConnector(connector); 


Line 63 is the problem. See the how Connector is created by ConnectorCreateRule
vs in the ServiceMBean

Also interesting is the following code in
org.apache.catalina.connector.Connector
   public Connector() {
        this(null);
    }

    public Connector(String protocol) {
        setProtocol(protocol);
        // Instantiate protocol handler
        try {
            Class<?> clazz = Class.forName(protocolHandlerClassName);
            this.protocolHandler = (ProtocolHandler) clazz.newInstance();
        } catch (Exception e) {
            log.error(sm.getString(
                    "coyoteConnector.protocolHandlerInstantiationFailed"), e);
        }
    }
protocolHandler is created in the beginning and is immutable and by default is
Http1.1.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org