Package org.apache.catalina

Examples of org.apache.catalina.Connector


    // Tell the embedded manager about the engine.
    //
    catEmbedded.addEngine(catEngine);
    InetAddress nullAddr = null;
    Connector connector = catEmbedded.createConnector(nullAddr, listeningPort,
        false);
    catEmbedded.addConnector(connector);

    // start up!
    catEmbedded.start();
View Full Code Here


     * @param attributes
     *            The attribute list of this element
     */
    public void begin(Attributes attributes) throws Exception {
        Class clazz;
        Connector connector;

        String className = attributes.getValue("className");
        clazz = Class.forName(className);

        if (className.equals("org.apache.coyote.tomcat4.CoyoteConnector")) {
View Full Code Here

        if (service instanceof StandardService) {
            ((StandardService) service).addPropertyChangeListener(this);
        }

        // Create the MBeans for the corresponding Connectors
        Connector connectors[] = service.findConnectors();
        for (int j = 0; j < connectors.length; j++) {
            createMBeans(connectors[j]);
        }

        // Create the MBean for the associated Engine and friends
View Full Code Here

        if (engine != null) {
            destroyMBeans(engine);
        }

        // Deregister the MBeans for the corresponding Connectors
        Connector connectors[] = service.findConnectors();
        for (int j = 0; j < connectors.length; j++) {
            destroyMBeans(connectors[j], service);
        }

        // Deregister the MBean for the Service itself
View Full Code Here

        writer.print("<Service");
        storeAttributes(writer, service);
        writer.println(">");

        // Store nested <Connector> elements
        Connector connectors[] = service.findConnectors();
        for (int i = 0; i < connectors.length; i++) {
            storeConnector(writer, indent + 2, connectors[i]);
        }

        // Store nested <Engine> element (or other appropriate container)
View Full Code Here

    public void addConnector(Connector connector) {

        synchronized (connectors) {
            connector.setContainer(this.container);
            connector.setService(this);
            Connector results[] = new Connector[connectors.length + 1];
            System.arraycopy(connectors, 0, results, 0, connectors.length);
            results[connectors.length] = connector;
            connectors = results;

            if (initialized) {
View Full Code Here

                }
            }
            connectors[j].setContainer(null);
            connector.setService(null);
            int k = 0;
            Connector results[] = new Connector[connectors.length - 1];
            for (int i = 0; i < connectors.length; i++) {
                if (i != j)
                    results[k++] = connectors[i];
            }
            connectors = results;
View Full Code Here

        Server server = ServerFactory.getServer();
        Service service = getService(oname);
        String port = oname.getKeyProperty("port");
        //String address = oname.getKeyProperty("address");

        Connector conns[] = (Connector[]) service.findConnectors();

        for (int i = 0; i < conns.length; i++) {
            Class cls = conns[i].getClass();
            Method getAddrMeth = cls.getMethod("getAddress", null);
            Object addrObj = getAddrMeth.invoke(conns[i], null);
View Full Code Here

        // Configure this Connector as needed
        connector.setContainer(engines[engines.length - 1]);

        // Add this Connector to our set of defined Connectors
        Connector results[] = new Connector[connectors.length + 1];
        for (int i = 0; i < connectors.length; i++)
            results[i] = connectors[i];
        results[connectors.length] = connector;
        connectors = results;
View Full Code Here

    }

    public Connector createConnector(String address, int port,
             String protocol) {

        Connector connector = null;

  if (address != null) {
      /*
       * InetAddress.toString() returns a string of the form
       * "<hostname>/<literal_IP>". Get the latter part, so that the
       * address can be parsed (back) into an InetAddress using
       * InetAddress.getByName().
       */
      int index = address.indexOf('/');
      if (index != -1) {
    address = address.substring(index + 1);
      }
  }

  if (log.isDebugEnabled()) {
            log.debug("Creating connector for address='" +
          ((address == null) ? "ALL" : address) +
          "' port='" + port + "' protocol='" + protocol + "'");
  }

        try {

            Class clazz =
                Class.forName("org.apache.coyote.tomcat5.CoyoteConnector");
            connector = (Connector) clazz.newInstance();

            if (address != null) {
                IntrospectionUtils.setProperty(connector, "address",
                                               "" + address);
            }
            IntrospectionUtils.setProperty(connector, "port", "" + port);

            if (protocol.equals("ajp")) {
                IntrospectionUtils.setProperty
                    (connector, "protocolHandlerClassName",
                     "org.apache.jk.server.JkCoyoteHandler");
            } else if (protocol.equals("memory")) {
                IntrospectionUtils.setProperty
                    (connector, "protocolHandlerClassName",
                     "org.apache.coyote.memory.MemoryProtocolHandler");
            } else if (protocol.equals("https")) {
                connector.setScheme("https");
                connector.setSecure(true);
                try {
                    Class serverSocketFactoryClass = Class.forName
                       ("org.apache.coyote.tomcat5.CoyoteServerSocketFactory");
                    ServerSocketFactory factory =
                        (ServerSocketFactory)
                        serverSocketFactoryClass.newInstance();
                    connector.setFactory(factory);
                } catch (Exception e) {
                    log.error("Couldn't load SSL server socket factory.");
                }
            }

View Full Code Here

TOP

Related Classes of org.apache.catalina.Connector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.