Package org.apache.catalina.connector

Examples of org.apache.catalina.connector.Connector


    @Override
    public void setNewSessionCookie(String sessionId, HttpServletResponse response) {
        if (response != null) {
            Context context = (Context) container;
            Connector connector = ((Response) response).getConnector();
            if (context.getCookies()) {
                // set a new session cookie
                Cookie cookie = new Cookie(Globals.SESSION_COOKIE_NAME, sessionId);
                // JBAS-6206. Configure cookie a la o.a.c.connector.Request.configureSessionCookie()
                cookie.setMaxAge(-1);
                if (context.getSessionCookie().getPath() != null) {
                    cookie.setPath(context.getSessionCookie().getPath());
                } else {
                    String contextPath = context.getEncodedPath();
                    if ("".equals(contextPath)) {
                        contextPath = "/";
                    }
                    cookie.setPath(contextPath);
                }
                if (context.getSessionCookie().getComment() != null) {
                    cookie.setComment(context.getSessionCookie().getComment());
                }
                if (context.getSessionCookie().getDomain() != null) {
                    cookie.setDomain(context.getSessionCookie().getDomain());
                }
                if (context.getSessionCookie().isHttpOnly()) {
                    cookie.setHttpOnly(true);
                }
                if (context.getSessionCookie().isSecure()) {
                    cookie.setSecure(true);
                }
                if (connector.getSecure()) {
                    cookie.setSecure(true);
                }

                log.tracef("Setting cookie with session id: %s & name: %s", sessionId, Globals.SESSION_COOKIE_NAME);
View Full Code Here


  public void createConnector(String address, String port, List<KeyValuePair> properties) throws Exception {
    ObjectName standardServiceName = new ObjectName(DOMAIN_NAME + ":type=Service");
    Set connectors = queryObjects(DOMAIN_NAME + ":address=" +  URLEncoder.encode("/" + address) +",port="
        + port + ",type=Connector,*");
    if (connectors.size() == 0) {
      Connector connector = null;
      connector = new Connector("org.apache.coyote.http11.Http11Protocol");
      connector.setPort(Integer.parseInt(port));
     
      for (KeyValuePair property : properties) {                  
        boolean effected = IntrospectionUtils.setProperty(connector, property.getKey(), property.getValue());
        if (!effected) {
          connector.setProperty(property.getKey(), property.getValue());
        }
      } 
     
      connector.setAttribute("address", address);
      mbeanServer.invoke(standardServiceName, "addConnector",
          new Object[] { connector }, new String[] { Connector.class
              .getName() });
        synchronized (connectorReference) {
        connectorReference.put(port, 1);
View Full Code Here

            protocol = "https";
        } else {
            protocol = "http";
        }

        Connector connector = null;
        if (UtilValidate.isNotEmpty(connectorProp.properties)) {
            connector = embedded.createConnector(address, port, protocol);
            try {
                for (ContainerConfig.Container.Property prop: connectorProp.properties.values()) {
                    connector.setProperty(prop.name, prop.value);
                    //connector.setAttribute(prop.name, prop.value);
                }
                embedded.addConnector(connector);
            } catch (Exception e) {
                throw new ContainerException(e);
View Full Code Here

        // Use BIO by default
        if (protocol == null) {
            protocol = "org.apache.coyote.http11.Http11Protocol";
        }

        Connector connector = new Connector(protocol);
        // If each test is running on same port - they
        // may interfere with each other (on unix at least)
        connector.setPort(getNextPort());
        // Mainly set to reduce timeouts during async tests
        connector.setAttribute("connectionTimeout", "3000");
        tomcat.getService().addConnector(connector);
        tomcat.setConnector(connector);

        // Add AprLifecycleListener if we are using the Apr connector
        if (protocol.contains("Apr")) {
            StandardServer server = (StandardServer) tomcat.getServer();
            AprLifecycleListener listener = new AprLifecycleListener();
            server.addLifecycleListener(listener);
            connector.setAttribute("pollerThreadCount", Integer.valueOf(1));
        }
       
        tomcat.setBaseDir(tempDir.getAbsolutePath());
        tomcat.getHost().setAppBase(appBase.getAbsolutePath());
    }
View Full Code Here

     */
    public static class MockHttpServletRequest extends Request {
        public MockHttpServletRequest() {
            super();
            setCoyoteRequest(new org.apache.coyote.Request());
            setConnector(new Connector());
        }
View Full Code Here

        tomcat.getConnector().start();
    }

    public void testStartStopBindOnStart() throws Exception {
        Tomcat tomcat = getTomcatInstance();
        Connector c = tomcat.getConnector();
        c.setProperty("bindOnInit", "false");
       
        File appDir = new File(getBuildDirectory(), "webapps/examples");
        tomcat.addWebapp(null, "/examples", appDir.getAbsolutePath());
       
        int port = getPort();
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 {

            if (protocol.equals("ajp")) {
                connector = new Connector("org.apache.coyote.ajp.AjpProtocol");
            } else if (protocol.equals("memory")) {
                connector = new Connector("org.apache.coyote.memory.MemoryProtocolHandler");
            } else if (protocol.equals("http")) {
                connector = new Connector();
            } else if (protocol.equals("https")) {
                connector = new Connector();
                connector.setScheme("https");
                connector.setSecure(true);
                connector.setProperty("SSLEnabled","true");
                // FIXME !!!! SET SSL PROPERTIES
            } else {
                connector = new Connector(protocol);
            }

            if (address != null) {
                IntrospectionUtils.setProperty(connector, "address",
                                               "" + address);
View Full Code Here

    @Override
    public void addConnector(Connector connector) {

        synchronized (connectors) {
            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 (getState().isAvailable()) {
View Full Code Here

                            connectors[j]), e);
                }
            }
            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

    }

    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 {

            if (protocol.equals("ajp")) {
                connector = new Connector("org.apache.jk.server.JkCoyoteHandler");
            } else if (protocol.equals("memory")) {
                connector = new Connector("org.apache.coyote.memory.MemoryProtocolHandler");
            } else if (protocol.equals("http")) {
                connector = new Connector();
            } else if (protocol.equals("https")) {
                connector = new Connector();
                connector.setScheme("https");
                connector.setSecure(true);
                connector.setProperty("SSLEnabled","true");
                // FIXME !!!! SET SSL PROPERTIES
            } else {
                connector = new Connector(protocol);
            }

            if (address != null) {
                IntrospectionUtils.setProperty(connector, "address",
                                               "" + address);
View Full Code Here

TOP

Related Classes of org.apache.catalina.connector.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.