View | Details | Raw Unified | Return to bug 60297
Collapse All | Expand All

(-)java/org/apache/catalina/startup/Tomcat.java (-7 / +15 lines)
Lines 138-144 Link Here
138
    protected Server server;
138
    protected Server server;
139
    protected Service service;
139
    protected Service service;
140
    protected Engine engine;
140
    protected Engine engine;
141
    protected Connector connector; // for more - customize the classes
142
141
143
    // To make it a bit easier to config for the common case
142
    // To make it a bit easier to config for the common case
144
    // ( one host, one context ).
143
    // ( one host, one context ).
Lines 417-425 Link Here
417
     * @return A connector object that can be customized
416
     * @return A connector object that can be customized
418
     */
417
     */
419
    public Connector getConnector() {
418
    public Connector getConnector() {
420
        getServer();
419
        Service service = getService();
421
        if (connector != null) {
420
        if (service.findConnectors().length > 0) {
422
            return connector;
421
            return service.findConnectors()[0];
423
        }
422
        }
424
423
425
        // The same as in standard Tomcat configuration.
424
        // The same as in standard Tomcat configuration.
Lines 426-439 Link Here
426
        // This creates an APR HTTP connector if AprLifecycleListener has been
425
        // This creates an APR HTTP connector if AprLifecycleListener has been
427
        // configured (created) and Tomcat Native library is available.
426
        // configured (created) and Tomcat Native library is available.
428
        // Otherwise it creates a NIO HTTP connector.
427
        // Otherwise it creates a NIO HTTP connector.
429
        connector = new Connector("HTTP/1.1");
428
        Connector connector = new Connector("HTTP/1.1");
430
        connector.setPort(port);
429
        connector.setPort(port);
431
        service.addConnector( connector );
430
        service.addConnector(connector);
432
        return connector;
431
        return connector;
433
    }
432
    }
434
433
435
    public void setConnector(Connector connector) {
434
    public void setConnector(Connector connector) {
436
        this.connector = connector;
435
        Service service = getService();
436
        boolean found = false;
437
        for (Connector serviceConnector : service.findConnectors()) {
438
            if (connector == serviceConnector) {
439
                found = true;
440
            }
441
        }
442
        if (!found) {
443
            service.addConnector(connector);
444
        }
437
    }
445
    }
438
446
439
    /**
447
    /**

Return to bug 60297