Package org.apache.geronimo.management.geronimo

Examples of org.apache.geronimo.management.geronimo.WebConnector


        while(true) {
            for (int i = 0; i < managers.length; i++) {
                WebManager manager = managers[i];
                WebConnector[] cons = (WebConnector[]) manager.getConnectors();
                for (int j = 0; j < cons.length; j++) {
                    WebConnector con = cons[j];
                    if(con.getPort() == port) {
                        port += 10;
                        continue outer;
                    }
                }
            }
View Full Code Here


        WebManager[] managers = PortletManager.getWebManagers(request);
        for (int i = 0; i < managers.length; i++) {
            WebManager manager = managers[i];
            WebConnector[] cons = (WebConnector[]) manager.getConnectors();
            for (int j = 0; j < cons.length; j++) {
                WebConnector con = cons[j];
                if(con.getPort() == model.getAddAjpPort().intValue()) {
                    return getMode()+BEFORE_ACTION; //todo: some sort of error message
                }
            }
        }
View Full Code Here

    public URL getURLFor() {
        WebConnector[] connectors = (WebConnector[]) jettyContainer.getConnectors();
        Map map = new HashMap();
        for (int i = 0; i < connectors.length; i++) {
            WebConnector connector = connectors[i];
            map.put(connector.getProtocol(), connector.getConnectUrl());
        }
        String urlPrefix;
        if ((urlPrefix = (String) map.get("HTTP")) == null) {
            if ((urlPrefix = (String) map.get("HTTPS")) == null) {
                urlPrefix = (String) map.get("AJP");
View Full Code Here

            int port = Integer.parseInt(actionRequest.getParameter("port"));
            int maxThreads = Integer.parseInt(actionRequest.getParameter("maxThreads"));
            Integer minThreads = getInteger(actionRequest, "minThreads");
            String displayName = actionRequest.getParameter("displayName");
            // Create and configure the connector
            WebConnector connector = PortletManager.createWebConnector(actionRequest, new AbstractName(URI.create(managerURI)), new AbstractName(URI.create(containerURI)), displayName, protocol, host, port);
            connector.setMaxThreads(maxThreads);
            // todo: more configurable HTTP/Jetty values
            if(server.equals(WEB_SERVER_JETTY)) {
                if(minThreads != null) {
                    setProperty(connector, "minThreads", minThreads);
                }
            } else if (server.equals(WEB_SERVER_TOMCAT)) {
                //todo:   Any Tomcat specific processing?
            } else {
                //todo:   Handle "should not occur" condition
            }
            if(protocol.equals(WebManager.PROTOCOL_HTTPS)) {
                String keystoreType = actionRequest.getParameter("keystoreType");
                String keystoreFile = actionRequest.getParameter("keystoreFile");
                String privateKeyPass = actionRequest.getParameter("privateKeyPassword");
                String keystorePass = actionRequest.getParameter("keystorePassword");
                String secureProtocol = actionRequest.getParameter("secureProtocol");
                String algorithm = actionRequest.getParameter("algorithm");
                String truststoreType = actionRequest.getParameter("truststoreType");
                String truststoreFile = actionRequest.getParameter("truststoreFile");
                String truststorePass = actionRequest.getParameter("truststorePassword");
                boolean clientAuth = isValid(actionRequest.getParameter("clientAuth"));
                SecureConnector secure = (SecureConnector) connector;
                if(isValid(keystoreType)) {secure.setKeystoreType(keystoreType);}
                if(isValid(keystoreFile)) {secure.setKeystoreFileName(keystoreFile);}
                if(isValid(keystorePass)) {secure.setKeystorePassword(keystorePass);}
                if(isValid(secureProtocol)) {secure.setSecureProtocol(secureProtocol);}
                if(isValid(algorithm)) {secure.setAlgorithm(algorithm);}
                secure.setClientAuthRequired(clientAuth);
                if(server.equals(WEB_SERVER_JETTY)) {
                    if(isValid(privateKeyPass)) {setProperty(secure, "keyPassword", privateKeyPass);}
                    String keyStore = actionRequest.getParameter("unlockKeyStore");
                    setProperty(secure, "keyStore", keyStore);
                    try {
                        KeystoreInstance[] keystores = PortletManager.getCurrentServer(actionRequest).getKeystoreManager().getKeystores();

                        String[] keys = null;
                        for (int i = 0; i < keystores.length; i++) {
                            KeystoreInstance keystore = keystores[i];
                            if(keystore.getKeystoreName().equals(keyStore)) {
                                keys = keystore.getUnlockedKeys(null);
                            }
                        }
                        if(keys != null && keys.length == 1) {
                            setProperty(secure, "keyAlias", keys[0]);
                        } else {
                            throw new PortletException("Cannot handle keystores with anything but 1 unlocked private key");
                        }
                    } catch (KeystoreException e) {
                        throw new PortletException(e);
                    }
                    String trustStore = actionRequest.getParameter("unlockTrustStore");
                    // "" is a valid trustStore value, which means the parameter should be cleared
                    setProperty(secure, "trustStore", isValid(trustStore) ? trustStore : null);
                } else if (server.equals(WEB_SERVER_TOMCAT)) {
                    if(isValid(truststoreType)) {setProperty(secure, "truststoreType", truststoreType);}
                    if(isValid(truststoreFile)) {setProperty(secure, "truststoreFileName", truststoreFile);}
                    if(isValid(truststorePass)) {setProperty(secure, "truststorePassword", truststorePass);}
                } else {
                    //todo:   Handle "should not occur" condition
                }
            }
            // Start the connector
            try {
                ((GeronimoManagedBean)connector).startRecursive();
            } catch (Exception e) {
                log.error("Unable to start connector", e); //todo: get into rendered page somehow?
            }
            actionResponse.setRenderParameter("mode", "list");
        } else if(mode.equals("save")) { // User just submitted the form to update a connector
            // Get submitted values
            //todo: lots of validation
            String host = actionRequest.getParameter("host");
            int port = Integer.parseInt(actionRequest.getParameter("port"));
            int maxThreads = Integer.parseInt(actionRequest.getParameter("maxThreads"));
            Integer minThreads = getInteger(actionRequest, "minThreads");
            String connectorURI = actionRequest.getParameter("connectorURI");
            // Identify and update the connector
            WebConnector connector = PortletManager.getWebConnector(actionRequest, new AbstractName(URI.create(connectorURI)));
            if(connector != null) {
                connector.setHost(host);
                connector.setPort(port);
                connector.setMaxThreads(maxThreads);
                if(server.equals(WEB_SERVER_JETTY)) {
                    if(minThreads != null) {
                        setProperty(connector,"minThreads",minThreads);
                    }
                    else if (server.equals(WEB_SERVER_TOMCAT)) {
                        //todo:   Any Tomcat specific processing?
                    }
                    else {
                        //todo:   Handle "should not occur" condition
                    }
                }
                if(connector instanceof SecureConnector) {
                    String keystoreType = actionRequest.getParameter("keystoreType");
                    String keystoreFile = actionRequest.getParameter("keystoreFile");
                    String privateKeyPass = actionRequest.getParameter("privateKeyPassword");
                    String keystorePass = actionRequest.getParameter("keystorePassword");
                    String secureProtocol = actionRequest.getParameter("secureProtocol");
                    String algorithm = actionRequest.getParameter("algorithm");
                    String truststoreType = actionRequest.getParameter("truststoreType");
                    String truststoreFile = actionRequest.getParameter("truststoreFile");
                    String truststorePass = actionRequest.getParameter("truststorePassword");
                    boolean clientAuth = isValid(actionRequest.getParameter("clientAuth"));
                    SecureConnector secure = (SecureConnector) connector;
                    if(isValid(keystoreType)) {secure.setKeystoreType(keystoreType);}
                    if(isValid(keystoreFile)) {secure.setKeystoreFileName(keystoreFile);}
                    if(isValid(keystorePass)) {secure.setKeystorePassword(keystorePass);}
                    if(isValid(secureProtocol)) {secure.setSecureProtocol(secureProtocol);}
                    if(isValid(algorithm)) {secure.setAlgorithm(algorithm);}
                    secure.setClientAuthRequired(clientAuth);
                    if(server.equals(WEB_SERVER_JETTY)) {
                        if(isValid(privateKeyPass)) {setProperty(secure, "keyPassword", privateKeyPass);}
                        String keyStore = actionRequest.getParameter("unlockKeyStore");
                        String trustStore = actionRequest.getParameter("unlockTrustStore");
                        setProperty(secure, "keyStore", keyStore);
                        try {
                            KeystoreInstance[] keystores = PortletManager.getCurrentServer(actionRequest).getKeystoreManager().getKeystores();

                            String[] keys = null;
                            for (int i = 0; i < keystores.length; i++) {
                                KeystoreInstance keystore = keystores[i];
                                if(keystore.getKeystoreName().equals(keyStore)) {
                                    keys = keystore.getUnlockedKeys(null);
                                }
                            }
                            if(keys != null && keys.length == 1) {
                                setProperty(secure, "keyAlias", keys[0]);
                            } else {
                                throw new PortletException("Cannot handle keystores with anything but 1 unlocked private key");
                            }
                        } catch (KeystoreException e) {
                            throw new PortletException(e);
                        }
                        // "" is a valid trustStore value, which means the parameter should be cleared
                        setProperty(secure, "trustStore", isValid(trustStore) ? trustStore : null);
                    }
                    else if (server.equals(WEB_SERVER_TOMCAT)) {
                        if(isValid(truststoreType)) {setProperty(secure, "truststoreType", truststoreType);}
                        if(isValid(truststorePass)) {setProperty(secure, "truststorePassword", truststorePass);}
                        if(isValid(truststoreFile)) {setProperty(secure, "truststoreFileName", truststoreFile);}
                    }
                    else {
                        //todo:   Handle "should not occur" condition
                    }
                }
            }
            actionResponse.setRenderParameter("mode", "list");
        } else if(mode.equals("start")) {
            String connectorURI = actionRequest.getParameter("connectorURI");
            // work with the current connector to start it.
            WebConnector connector = PortletManager.getWebConnector(actionRequest, new AbstractName(URI.create(connectorURI)));
            if(connector != null) {
                try {
                    ((GeronimoManagedBean)connector).startRecursive();
                } catch (Exception e) {
                    log.error("Unable to start connector", e); //todo: get into rendered page somehow?
                }
            }
            else {
                log.error("Incorrect connector reference"); //Replace this with correct error processing
            }
            actionResponse.setRenderParameter("connectorURI", connectorURI);
            actionResponse.setRenderParameter("mode", "list");
        } else if(mode.equals("stop")) {
            String connectorURI = actionRequest.getParameter("connectorURI");
            // work with the current connector to stop it.
            WebConnector connector = PortletManager.getWebConnector(actionRequest, new AbstractName(URI.create(connectorURI)));
            if(connector != null) {
                try {
                    ((GeronimoManagedBean)connector).stop();
                } catch (Exception e) {
                    log.error("Unable to stop connector", e); //todo: get into rendered page somehow?
View Full Code Here

                    editHttpView.include(renderRequest, renderResponse);
                }

            } else if(mode.equals("edit")) {
                String connectorURI = renderRequest.getParameter("connectorURI");
                WebConnector connector = PortletManager.getWebConnector(renderRequest, new AbstractName(URI.create(connectorURI)));
                if(connector == null) {
                    doList(renderRequest, renderResponse);
                } else {
                  String displayName = new AbstractName(URI.create(connectorURI)).getName().get("name").toString();
                    renderRequest.setAttribute("displayName", displayName);
                    renderRequest.setAttribute("connectorURI", connectorURI);
                    renderRequest.setAttribute("port", new Integer(connector.getPort()));
                    renderRequest.setAttribute("host", connector.getHost());
                    int maxThreads = connector.getMaxThreads();
                    renderRequest.setAttribute("maxThreads", Integer.toString(maxThreads));
                    if(server.equals(WEB_SERVER_JETTY)) {
                        int minThreads = ((Number)getProperty(connector, "minThreads")).intValue();
                        renderRequest.setAttribute("minThreads", String.valueOf(minThreads));
                        KeystoreManager mgr = PortletManager.getCurrentServer(renderRequest).getKeystoreManager();
                        KeystoreInstance[] stores = mgr.getUnlockedKeyStores();
                        String[] storeNames = new String[stores.length];
                        for (int i = 0; i < storeNames.length; i++) {
                            storeNames[i] = stores[i].getKeystoreName();
                        }
                        renderRequest.setAttribute("keyStores", storeNames);
                        KeystoreInstance[] trusts = mgr.getUnlockedTrustStores();
                        String[] trustNames = new String[trusts.length];
                        for (int i = 0; i < trustNames.length; i++) {
                            trustNames[i] = trusts[i].getKeystoreName();
                        }
                        renderRequest.setAttribute("trustStores", trustNames);
                        Map aliases = new HashMap();
                        for (int i = 0; i < stores.length; i++) {
                            try {
                                aliases.put(stores[i].getKeystoreName(), stores[i].getUnlockedKeys(null));
                            } catch (KeystoreException e) {}
                        }
                        renderRequest.setAttribute("unlockedKeys", aliases);
                    }
                    else if (server.equals(WEB_SERVER_TOMCAT)) {
                        //todo:   Any Tomcat specific processing?
                    }
                    else {
                        //todo:   Handle "should not occur" condition
                    }
                    renderRequest.setAttribute("mode", "save");

                    if(connector instanceof SecureConnector) {
                        SecureConnector secure = (SecureConnector) connector;
                        renderRequest.setAttribute("keystoreFile",secure.getKeystoreFileName());
                        renderRequest.setAttribute("keystoreType",secure.getKeystoreType());
                        renderRequest.setAttribute("algorithm",secure.getAlgorithm());
                        renderRequest.setAttribute("secureProtocol",secure.getSecureProtocol());
                        if(secure.isClientAuthRequired()) {
                            renderRequest.setAttribute("clientAuth", Boolean.TRUE);
                        }
                        if(server.equals(WEB_SERVER_JETTY)) {
                            String keyStore = (String)getProperty(secure, "keyStore");
                            String trustStore = (String)getProperty(secure, "trustStore");
                            renderRequest.setAttribute("unlockKeyStore", keyStore);
                            renderRequest.setAttribute("unlockTrustStore", trustStore);
                        } else if(server.equals(WEB_SERVER_TOMCAT)) {
                            String truststoreFile = (String)getProperty(secure, "truststoreFileName");
                            String truststoreType = (String)getProperty(secure, "truststoreType");
                            renderRequest.setAttribute("truststoreFile", truststoreFile);
                            renderRequest.setAttribute("truststoreType", truststoreType);
                        }
                    }

                    if(connector.getProtocol().equals(WebManager.PROTOCOL_HTTPS)) {
                        editHttpsView.include(renderRequest, renderResponse);
                    } else {
                        editHttpView.include(renderRequest, renderResponse);
                    }
                }
View Full Code Here

                }
                ContainerInfo result = new ContainerInfo(id, webManagerName.toString(), containerName.toString());

                WebConnector[] connectors = (WebConnector[]) manager.getConnectorsForContainer(container);
                for (int k = 0; k < connectors.length; k++) {
                    WebConnector connector = connectors[k];
                    ConnectorInfo info = new ConnectorInfo();
                    AbstractName connectorName = PortletManager.getNameFor(renderRequest, connector);
                    info.setConnectorURI(connectorName.toString());
                    info.setDescription(PortletManager.getGBeanDescription(renderRequest, connectorName));
                    info.setDisplayName((String)connectorName.getName().get(NameFactory.J2EE_NAME));
                    info.setState(((GeronimoManagedBean)connector).getState());
                    info.setPort(connector.getPort());
                    try {
                        info.setProtocol(connector.getProtocol());
                    } catch (IllegalStateException e) {
                        info.setProtocol("unknown");
                    }
                    beans.add(info);
                }
View Full Code Here

            int port = Integer.parseInt(actionRequest.getParameter("port"));
            int maxThreads = Integer.parseInt(actionRequest.getParameter("maxThreads"));
            Integer minThreads = getInteger(actionRequest, "minThreads");
            String displayName = actionRequest.getParameter("displayName");
            // Create and configure the connector
            WebConnector connector = PortletManager.createWebConnector(actionRequest, new AbstractName(URI.create(managerURI)), new AbstractName(URI.create(containerURI)), displayName, protocol, host, port);
            connector.setMaxThreads(maxThreads);
            // todo: more configurable HTTP/Jetty values
            if(server.equals(WEB_SERVER_JETTY)) {
                if(minThreads != null) {
                    setProperty(connector, "minThreads", minThreads);
                }
            } else if (server.equals(WEB_SERVER_TOMCAT)) {
                //todo:   Any Tomcat specific processing?
            } else {
                //todo:   Handle "should not occur" condition
            }
            if(protocol.equals(WebManager.PROTOCOL_HTTPS)) {
                String keystoreType = actionRequest.getParameter("keystoreType");
                String keystoreFile = actionRequest.getParameter("keystoreFile");
                String privateKeyPass = actionRequest.getParameter("privateKeyPassword");
                String keystorePass = actionRequest.getParameter("keystorePassword");
                String secureProtocol = actionRequest.getParameter("secureProtocol");
                String algorithm = actionRequest.getParameter("algorithm");
                String truststoreType = actionRequest.getParameter("truststoreType");
                String truststoreFile = actionRequest.getParameter("truststoreFile");
                String truststorePass = actionRequest.getParameter("truststorePassword");
                boolean clientAuth = isValid(actionRequest.getParameter("clientAuth"));
                SecureConnector secure = (SecureConnector) connector;
                if(isValid(keystoreType)) {secure.setKeystoreType(keystoreType);}
                if(isValid(keystoreFile)) {secure.setKeystoreFileName(keystoreFile);}
                if(isValid(keystorePass)) {secure.setKeystorePassword(keystorePass);}
                if(isValid(secureProtocol)) {secure.setSecureProtocol(secureProtocol);}
                if(isValid(algorithm)) {secure.setAlgorithm(algorithm);}
                secure.setClientAuthRequired(clientAuth);
                if(server.equals(WEB_SERVER_JETTY)) {
                    if(isValid(privateKeyPass)) {setProperty(secure, "keyPassword", privateKeyPass);}
                    String keyStore = actionRequest.getParameter("unlockKeyStore");
                    setProperty(secure, "keyStore", keyStore);
                    try {
                        KeystoreInstance[] keystores = PortletManager.getCurrentServer(actionRequest).getKeystoreManager().getKeystores();

                        String[] keys = null;
                        for (int i = 0; i < keystores.length; i++) {
                            KeystoreInstance keystore = keystores[i];
                            if(keystore.getKeystoreName().equals(keyStore)) {
                                keys = keystore.getUnlockedKeys();
                            }
                        }
                        if(keys != null && keys.length == 1) {
                            setProperty(secure, "keyAlias", keys[0]);
                        } else {
                            throw new PortletException("Cannot handle keystores with anything but 1 unlocked private key");
                        }
                    } catch (KeystoreIsLocked locked) {
                        throw new PortletException(locked.getMessage());
                    }
                    String trustStore = actionRequest.getParameter("unlockTrustStore");
                    if(isValid(trustStore)) {setProperty(secure, "trustStore", trustStore);}
                } else if (server.equals(WEB_SERVER_TOMCAT)) {
                    if(isValid(truststoreType)) {setProperty(secure, "truststoreType", truststoreType);}
                    if(isValid(truststoreFile)) {setProperty(secure, "truststoreFileName", truststoreFile);}
                    if(isValid(truststorePass)) {setProperty(secure, "truststorePassword", truststorePass);}
                } else {
                    //todo:   Handle "should not occur" condition
                }
            }
            // Start the connector
            try {
                ((GeronimoManagedBean)connector).startRecursive();
            } catch (Exception e) {
                log.error("Unable to start connector", e); //todo: get into rendered page somehow?
            }
            actionResponse.setRenderParameter("mode", "list");
        } else if(mode.equals("save")) { // User just submitted the form to update a connector
            // Get submitted values
            //todo: lots of validation
            String host = actionRequest.getParameter("host");
            int port = Integer.parseInt(actionRequest.getParameter("port"));
            int maxThreads = Integer.parseInt(actionRequest.getParameter("maxThreads"));
            Integer minThreads = getInteger(actionRequest, "minThreads");
            String connectorURI = actionRequest.getParameter("connectorURI");
            // Identify and update the connector
            WebConnector connector = PortletManager.getWebConnector(actionRequest, new AbstractName(URI.create(connectorURI)));
            if(connector != null) {
                connector.setHost(host);
                connector.setPort(port);
                connector.setMaxThreads(maxThreads);
                if(server.equals(WEB_SERVER_JETTY)) {
                    if(minThreads != null) {
                        setProperty(connector,"minThreads",minThreads);
                    }
                    else if (server.equals(WEB_SERVER_TOMCAT)) {
                        //todo:   Any Tomcat specific processing?
                    }
                    else {
                        //todo:   Handle "should not occur" condition
                    }
                }
                if(connector instanceof SecureConnector) {
                    String keystoreType = actionRequest.getParameter("keystoreType");
                    String keystoreFile = actionRequest.getParameter("keystoreFile");
                    String privateKeyPass = actionRequest.getParameter("privateKeyPassword");
                    String keystorePass = actionRequest.getParameter("keystorePassword");
                    String secureProtocol = actionRequest.getParameter("secureProtocol");
                    String algorithm = actionRequest.getParameter("algorithm");
                    String truststoreType = actionRequest.getParameter("truststoreType");
                    String truststoreFile = actionRequest.getParameter("truststoreFile");
                    String truststorePass = actionRequest.getParameter("truststorePassword");
                    boolean clientAuth = isValid(actionRequest.getParameter("clientAuth"));
                    SecureConnector secure = (SecureConnector) connector;
                    if(isValid(keystoreType)) {secure.setKeystoreType(keystoreType);}
                    if(isValid(keystoreFile)) {secure.setKeystoreFileName(keystoreFile);}
                    if(isValid(keystorePass)) {secure.setKeystorePassword(keystorePass);}
                    if(isValid(secureProtocol)) {secure.setSecureProtocol(secureProtocol);}
                    if(isValid(algorithm)) {secure.setAlgorithm(algorithm);}
                    secure.setClientAuthRequired(clientAuth);
                    if(server.equals(WEB_SERVER_JETTY)) {
                        if(isValid(privateKeyPass)) {setProperty(secure, "keyPassword", privateKeyPass);}
                    }
                    else if (server.equals(WEB_SERVER_TOMCAT)) {
                        if(isValid(truststoreType)) {setProperty(secure, "truststoreType", truststoreType);}
                        if(isValid(truststorePass)) {setProperty(secure, "truststorePassword", truststorePass);}
                        if(isValid(truststoreFile)) {setProperty(secure, "truststoreFileName", truststoreFile);}
                    }
                    else {
                        //todo:   Handle "should not occur" condition
                    }
                }
            }
            actionResponse.setRenderParameter("mode", "list");
        } else if(mode.equals("start")) {
            String connectorURI = actionRequest.getParameter("connectorURI");
            // work with the current connector to start it.
            WebConnector connector = PortletManager.getWebConnector(actionRequest, new AbstractName(URI.create(connectorURI)));
            if(connector != null) {
                try {
                    ((GeronimoManagedBean)connector).startRecursive();
                } catch (Exception e) {
                    log.error("Unable to start connector", e); //todo: get into rendered page somehow?
                }
            }
            else {
                log.error("Incorrect connector reference"); //Replace this with correct error processing
            }
            actionResponse.setRenderParameter("connectorURI", connectorURI);
            actionResponse.setRenderParameter("mode", "list");
        } else if(mode.equals("stop")) {
            String connectorURI = actionRequest.getParameter("connectorURI");
            // work with the current connector to stop it.
            WebConnector connector = PortletManager.getWebConnector(actionRequest, new AbstractName(URI.create(connectorURI)));
            if(connector != null) {
                try {
                    ((GeronimoManagedBean)connector).stop();
                } catch (Exception e) {
                    log.error("Unable to stop connector", e); //todo: get into rendered page somehow?
View Full Code Here

                    editHttpView.include(renderRequest, renderResponse);
                }

            } else if(mode.equals("edit")) {
                String connectorURI = renderRequest.getParameter("connectorURI");
                WebConnector connector = PortletManager.getWebConnector(renderRequest, new AbstractName(URI.create(connectorURI)));
                if(connector == null) {
                    doList(renderRequest, renderResponse);
                } else {
                  String displayName = new AbstractName(URI.create(connectorURI)).getName().get("name").toString();
                    renderRequest.setAttribute("displayName", displayName);
                    renderRequest.setAttribute("connectorURI", connectorURI);
                    renderRequest.setAttribute("port", new Integer(connector.getPort()));
                    renderRequest.setAttribute("host", connector.getHost());
                    int maxThreads = connector.getMaxThreads();
                    renderRequest.setAttribute("maxThreads", Integer.toString(maxThreads));
                    if(server.equals(WEB_SERVER_JETTY)) {
                        int minThreads = ((Number)getProperty(connector, "minThreads")).intValue();
                        renderRequest.setAttribute("minThreads", String.valueOf(minThreads));
                        KeystoreManager mgr = PortletManager.getCurrentServer(renderRequest).getKeystoreManager();
                        KeystoreInstance[] stores = mgr.getUnlockedKeyStores();
                        String[] storeNames = new String[stores.length];
                        for (int i = 0; i < storeNames.length; i++) {
                            storeNames[i] = stores[i].getKeystoreName();
                        }
                        renderRequest.setAttribute("keyStores", storeNames);
                        KeystoreInstance[] trusts = mgr.getUnlockedTrustStores();
                        String[] trustNames = new String[trusts.length];
                        for (int i = 0; i < trustNames.length; i++) {
                            trustNames[i] = trusts[i].getKeystoreName();
                        }
                        renderRequest.setAttribute("trustStores", trustNames);
                        Map aliases = new HashMap();
                        for (int i = 0; i < stores.length; i++) {
                            try {
                                aliases.put(stores[i].getKeystoreName(), stores[i].getUnlockedKeys());
                            } catch (KeystoreIsLocked locked) {}
                        }
                        renderRequest.setAttribute("unlockedKeys", aliases);
                    }
                    else if (server.equals(WEB_SERVER_TOMCAT)) {
                        //todo:   Any Tomcat specific processing?
                    }
                    else {
                        //todo:   Handle "should not occur" condition
                    }
                    renderRequest.setAttribute("mode", "save");

                    if(connector instanceof SecureConnector) {
                        SecureConnector secure = (SecureConnector) connector;
                        renderRequest.setAttribute("keystoreFile",secure.getKeystoreFileName());
                        renderRequest.setAttribute("keystoreType",secure.getKeystoreType());
                        renderRequest.setAttribute("algorithm",secure.getAlgorithm());
                        renderRequest.setAttribute("secureProtocol",secure.getSecureProtocol());
                        if(secure.isClientAuthRequired()) {
                            renderRequest.setAttribute("clientAuth", Boolean.TRUE);
                        }
                        if(server.equals(WEB_SERVER_TOMCAT)) {
                            String truststoreFile = (String)getProperty(secure, "truststoreFileName");
                            String truststoreType = (String)getProperty(secure, "truststoreType");
                            renderRequest.setAttribute("truststoreFile", truststoreFile);
                            renderRequest.setAttribute("truststoreType", truststoreType);
                        }
                    }

                    if(connector.getProtocol().equals(WebManager.PROTOCOL_HTTPS)) {
                        editHttpsView.include(renderRequest, renderResponse);
                    } else {
                        editHttpView.include(renderRequest, renderResponse);
                    }
                }
View Full Code Here

                }
                ContainerInfo result = new ContainerInfo(id, webManagerName.toString(), containerName.toString());

                WebConnector[] connectors = (WebConnector[]) manager.getConnectorsForContainer(container);
                for (int k = 0; k < connectors.length; k++) {
                    WebConnector connector = connectors[k];
                    ConnectorInfo info = new ConnectorInfo();
                    AbstractName connectorName = PortletManager.getNameFor(renderRequest, connector);
                    info.setConnectorURI(connectorName.toString());
                    info.setDescription(PortletManager.getGBeanDescription(renderRequest, connectorName));
                    info.setDisplayName((String)connectorName.getName().get(NameFactory.J2EE_NAME));
                    info.setState(((GeronimoManagedBean)connector).getState());
                    info.setPort(connector.getPort());
                    try {
                        info.setProtocol(connector.getProtocol());
                    } catch (IllegalStateException e) {
                        info.setProtocol("unknown");
                    }
                    beans.add(info);
                }
View Full Code Here

        while(true) {
            for (int i = 0; i < managers.length; i++) {
                WebManager manager = managers[i];
                WebConnector[] cons = (WebConnector[]) manager.getConnectors();
                for (int j = 0; j < cons.length; j++) {
                    WebConnector con = cons[j];
                    if(con.getPort() == port) {
                        port += 10;
                        continue outer;
                    }
                }
            }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.management.geronimo.WebConnector

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.