Examples of ContextKey


Examples of com.adito.boot.ContextKey

    }

    private void registerKeyStores() throws Exception {
        getBootProgressMonitor().updateMessage("Registering key stores");
        getBootProgressMonitor().updateProgress(7);
        String defaultKeyStorePassword = contextConfiguration.retrieveProperty(new ContextKey(
                        "webServer.keystore.sslCertificate.password"));
        KeyStoreManager.registerKeyStore(KeyStoreManager.DEFAULT_KEY_STORE, "keystore", true, defaultKeyStorePassword,
            KeyStoreManager.getKeyStoreType(contextConfiguration.retrieveProperty(new ContextKey("webServer.keyStoreType"))));

        KeyStoreManager.registerKeyStore(KeyStoreManager.SERVER_AUTHENTICATION_CERTIFICATES_KEY_STORE, "keystore", true,
            "adito", KeyStoreManager.TYPE_JKS);
        KeyStoreManager.registerKeyStore(KeyStoreManager.TRUSTED_SERVER_CERTIFICATES_KEY_STORE, "keystore", true, "adito",
            KeyStoreManager.TYPE_JKS);
View Full Code Here

Examples of com.adito.boot.ContextKey

        log = LogFactory.getLog(Main.class);
    }

    private void startHttpServer() throws Exception {

        int port = contextConfiguration.retrievePropertyInt(new ContextKey("webServer.httpRedirectPort"));
        if (port <= 0) {
            if (log.isInfoEnabled())
                log.info("HTTP redirect port " + port + " is invalid");
            return;
        }
       
        String bind = contextConfiguration.retrieveProperty(new ContextKey("webServer.bindAddress"));
        PropertyList l = new PropertyList(bind.equals("") ? "0.0.0.0" : bind);
        insecureServer = new Server();
        for (Iterator<String> i = l.iterator(); i.hasNext();) {
            String address = i.next();
            if (log.isInfoEnabled())
                log.info("Adding listener on " + address + ":" + port);
            SocketListener listener = new SocketListener();
            listener.setHost(address);
            listener.setPort(port);
            listener.setMinThreads(contextConfiguration.retrievePropertyInt(new ContextKey("webServer.minThreads")));
            listener.setMaxThreads(contextConfiguration.retrievePropertyInt(new ContextKey("webServer.maxThreads")));
            listener.setMaxIdleTimeMs(0);
            listener.setLowResourcePersistTimeMs(2000);
            listener.setAcceptQueueSize(0);
            listener.setPoolName("P2");
            insecureServer.addListener(listener);
View Full Code Here

Examples of com.adito.boot.ContextKey

        server = createServer();

        // SunJsseListener listener = new SunJsseListener();
        String keystorePassword = contextConfiguration
                        .retrieveProperty(new ContextKey("webServer.keystore.sslCertificate.password"));
        if (keystorePassword.equals("")) {
            throw new Exception(
                            "Private key / certificate password has not been set. Please run the Installation Wizard.");
        }

        actualPort = defaultPort == -1 ? contextConfiguration.retrievePropertyInt(new ContextKey("webServer.port")) : defaultPort;
        String bind = contextConfiguration.retrieveProperty(new ContextKey("webServer.bindAddress"));
        listeners = new ArrayList<SocketListener>();
        PropertyList l = new PropertyList(bind.equals("") ? "0.0.0.0" : bind);
        for (Iterator<String> i = l.iterator(); i.hasNext();) {
            String address = i.next();
            if (log.isInfoEnabled())
                log.info("Adding listener on " + address + ":" + actualPort);
            if (!serverLock.isStarted()) {
                serverLock.start(actualPort);
            }
            SocketListener listener = null;
            if (contextConfiguration.retrieveProperty(new ContextKey("webServer.protocol")).equals("http")) {
                listener = new SocketListener();
                log.warn("The server is configured to listen for plain HTTP connections.");
            } else {
                listener = new CustomJsseListener(keystorePassword);
                MsieSslHandler sslHandler = new MsieSslHandler();
                sslHandler.setUserAgentSubString("MSIE 5");
                listener.setHttpHandler(sslHandler);
            }
            listener.setPort(actualPort);
            listener.setMinThreads(contextConfiguration.retrievePropertyInt(new ContextKey("webServer.minThreads")));
            listener.setMaxThreads(contextConfiguration.retrievePropertyInt(new ContextKey("webServer.maxThreads")));
            listener.setMaxIdleTimeMs(contextConfiguration.retrievePropertyInt(new ContextKey("webServer.maxIdleTimeMs")));
            listener.setHost(address);
            listener.setBufferSize(contextConfiguration.retrievePropertyInt(new ContextKey("webServer.bufferSize")));
            listener.setBufferReserve(contextConfiguration.retrievePropertyInt(new ContextKey("webServer.bufferReserve")));
            listener.setTcpNoDelay(contextConfiguration.retrievePropertyBoolean(new ContextKey("webServer.tcpNoDelay")));
            listener.setThreadsPriority(contextConfiguration.retrievePropertyInt(new ContextKey("webServer.threadPriority")));
            listeners.add(listener);

            listener.setLowResourcePersistTimeMs(contextConfiguration.retrievePropertyInt(new ContextKey(
                            "webServer.lowResourcePersistTimeMs")));
            listener.setPoolName("main");
            server.addListener(listener);
        }
       
        // Add the context
        getBootProgressMonitor().updateMessage("Creating web application");
        getBootProgressMonitor().updateProgress(9);
        httpContext = new CustomHttpContext(server, "/", useDevConfig, bootLoader);
        httpContext.setRedirectNullPath(false);
        server.addContext(httpContext);

        // Dunny servlet handler for faking HttpServletRequest,
        // HttpServletResponse
        servletHandler = new ServletHandler();
        servletHandler.initialize(httpContext);
        servletHandler.start();

        // Add the webapp
        webappContext = new CustomWebApplicationContext(useDevConfig, bootLoader);
        addLifecycleListener(webappContext);

        server.addContext(webappContext);
        webappContext.setRedirectNullPath(false);

        // Configure the server
        server.setRequestsPerGC(contextConfiguration.retrievePropertyInt(new ContextKey("webServer.requestsPerGC")));
        server.setTrace(false);

        // Set the request log
        if (contextConfiguration.retrievePropertyBoolean(new ContextKey("webServer.requestLog"))) {
            NCSARequestLog requestLog = new NCSARequestLog(jettyLog);
            requestLog.setRetainDays(90);
            requestLog.setAppend(true);
            requestLog.setExtended(false);
            requestLog.setBuffered(false);
View Full Code Here

Examples of com.adito.boot.ContextKey

    private void configureProxyServers() throws Exception {
        getBootProgressMonitor().updateMessage("Configuring proxy servers");
        getBootProgressMonitor().updateProgress(5);

        String httpProxyHost = contextConfiguration.retrieveProperty(new ContextKey("proxies.http.proxyHost"));
        if (!httpProxyHost.equals("")) {
            if (log.isInfoEnabled())
                log.info("Configuring outgoing HTTP connections to use a proxy server.");
            System.setProperty("http.proxyHost", httpProxyHost);
            System.setProperty("com.maverick.ssl.https.HTTPProxyHostname", httpProxyHost);
            String httpProxyPort = contextConfiguration.retrieveProperty(new ContextKey("proxies.http.proxyPort"));

            String httpProxyUsername = contextConfiguration.retrieveProperty(new ContextKey("proxies.http.proxyUser"));
            String httpProxyPassword = contextConfiguration.retrieveProperty(new ContextKey("proxies.http.proxyPassword"));

            System.setProperty("http.proxyPort", httpProxyPort);
            System.setProperty("com.maverick.ssl.https.HTTPProxyPort", httpProxyPort);

            if (!httpProxyUsername.trim().equals(""))
                System.setProperty("com.maverick.ssl.https.HTTPProxyUsername", httpProxyUsername.trim());

            if (!httpProxyPassword.trim().equals(""))
                System.setProperty("com.maverick.ssl.https.HTTPProxyPassword", httpProxyPassword.trim());

            System.setProperty("com.maverick.ssl.https.HTTPProxySecure", "false");

            PropertyList list = contextConfiguration.retrievePropertyList(new ContextKey("proxies.http.nonProxyHosts"));
            StringBuffer hosts = new StringBuffer();
            for (Iterator i = list.iterator(); i.hasNext();) {
                if (hosts.length() != 0) {
                    hosts.append("|");
                }
                hosts.append(i.next());
            }
            System.setProperty("http.nonProxyHosts", hosts.toString());
            System.setProperty("com.maverick.ssl.https.HTTPProxyNonProxyHosts", hosts.toString());
        }
        String socksProxyHost = contextConfiguration.retrieveProperty(new ContextKey("proxies.socksProxyHost"));
        if (!socksProxyHost.equals("")) {
            if (log.isInfoEnabled())
                log.info("Configuring outgoing TCP/IP connections to use a SOCKS proxy server.");
            System.setProperty("socksProxyHost", httpProxyHost);
            System.setProperty("socksProxyPort", contextConfiguration.retrieveProperty(new ContextKey("proxies.socksProxyPort")));
        }
        if (!socksProxyHost.equals("") || !httpProxyHost.equals("")) {
            Authenticator.setDefault(new ProxyAuthenticator());
        }
    }
View Full Code Here

Examples of com.adito.boot.ContextKey

        }
    }

    private Server createServer() throws MalformedURLException {
        Server server = new Server();
        if (contextConfiguration.retrievePropertyBoolean(new ContextKey("webServer.stats"))) {
            new StatsLogger(server, contextConfiguration.retrievePropertyInt(new ContextKey("webServer.statsUpdate")));
        }
        return server;
    }
View Full Code Here

Examples of com.adito.boot.ContextKey

        if (l == null) {
            l = new FileDownloadPageInterceptListener();
            CoreUtil.addPageInterceptListener(request.getSession(), l);
        }
        File f = new File(CoreUtil.getTempDownloadDirectory(getSessionInfo(request)), "server.csr");
        String pw = Property.getProperty(new ContextKey("webServer.keystore.sslCertificate.password"));
        String data = KeyStoreManager.getInstance(KeyStoreManager.DEFAULT_KEY_STORE).generateCSR(Property.getProperty(new ContextKey("webServer.alias")), pw);
        FileWriter fos = new FileWriter(f);
        fos.write(data);
        fos.flush();
        fos.close();
        l.addDownload(new CSRDownload(f, f.getName(), "application/octet-stream", mapping.findForward("success"),
View Full Code Here

Examples of com.adito.boot.ContextKey

    /* (non-Javadoc)
     * @see javax.net.ssl.X509KeyManager#chooseServerAlias(java.lang.String, java.security.Principal[], java.net.Socket)
     */
    public String chooseServerAlias(String keyType, Principal[] issuers, Socket socket) {
        String alias = ContextHolder.getContext().getConfig().retrieveProperty(new ContextKey("webServer.alias"));
        return alias;
    }
View Full Code Here

Examples of com.adito.boot.ContextKey

    /* (non-Javadoc)
     * @see javax.net.ssl.X509KeyManager#getPrivateKey(java.lang.String)
     */
    public PrivateKey getPrivateKey(String alias) {
        try {
            return (PrivateKey) KeyStoreManager.getInstance(KeyStoreManager.DEFAULT_KEY_STORE).getPrivateKey(contextConfig.retrieveProperty(new ContextKey("webServer.alias")), contextConfig.retrieveProperty(new ContextKey("webServer.keystore.sslCertificate.password")).toCharArray());
        } catch (Exception e) {
            Main.log.error(e);
        }
        return null;
    }
View Full Code Here

Examples of com.adito.boot.ContextKey

    /* (non-Javadoc)
     * @see javax.net.ssl.X509KeyManager#getServerAliases(java.lang.String, java.security.Principal[])
     */
    public String[] getServerAliases(String keyType, Principal[] issuers) {
        String str[] = { contextConfig.retrieveProperty(new ContextKey("webServer.alias")) };
        return str;
    }
View Full Code Here

Examples of com.adito.boot.ContextKey

  @Override
  public String processReplacementVariable(Pattern pattern, Matcher matcher, String replacementPattern, String type, String key) throws Exception {
    if (type.equalsIgnoreCase(KeyStoreManager.DEFAULT_KEY_STORE)) {
            if (key.equals("untrustedCertificate")) {
                return String.valueOf(!KeyStoreManager.getInstance(KeyStoreManager.DEFAULT_KEY_STORE)
                                .isCertificateTrusted(Property.getProperty(new ContextKey("webServer.alias"))));
            } else {
                throw new Exception("Unknown key " + key + " for type " + type + ".");
            }
        } else if (type.equalsIgnoreCase("server")) {
            // NOTE 29/1/06 - BPS - This is here to maintain
            // compatibility with current extension descriptors
            if (key.equals("untrustedCertificate")) {
                return String.valueOf(!KeyStoreManager.getInstance(KeyStoreManager.DEFAULT_KEY_STORE)
                                .isCertificateTrusted(Property.getProperty(new ContextKey("webServer.alias"))));
            } else if (key.equals("disableNewSSLEngine")){
                return SystemProperties.get("adito.disableNewSSLEngine", "false");
            } else {
                throw new Exception("Unknown key " + key + " for type " + type + ".");
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.