Package org.glassfish.grizzly.config.dom

Examples of org.glassfish.grizzly.config.dom.NetworkListener


    private NetworkListener getAdminListener()
    {
        final NetworkConfig network = networkConfig();

        final NetworkListener listener = network.getNetworkListener(ADMIN_LISTENER_NAME);
        return listener;
    }
View Full Code Here


    }

    private void prepareDASConfig() throws TransactionFailure, PropertyVetoException {
        final Config dasConfig = writableConfig(configs.getConfigByName(DAS_CONFIG_NAME));
        final NetworkConfig nc = dasConfig.getNetworkConfig();
        final NetworkListener nl_w = transaction().enroll(nc.getNetworkListener(SecureAdminCommand.ADMIN_LISTENER_NAME));
        nl_w.setProtocol(SecureAdminCommand.ADMIN_LISTENER_NAME);
    }
View Full Code Here

//        }
//    }
   
    private void ensureConfigReady(final Config c, final String adminListenerProtocol) throws TransactionFailure, PropertyVetoException {
        final NetworkConfig nc = c.getNetworkConfig();
        final NetworkListener nl = nc.getNetworkListener(SecureAdminCommand.ADMIN_LISTENER_NAME);
        if (nl != null) {
            return;
        }

        /*
 
View Full Code Here

    private NetworkListener createAdminNetworkListener(
            final Transaction t,
            final NetworkConfig nc,
            final String adminListenerProtocolName) throws TransactionFailure {
        final NetworkListeners nls_w = t.enroll(nc.getNetworkListeners());
        final NetworkListener nl_w = nls_w.createChild(NetworkListener.class);
        nls_w.getNetworkListener().add(nl_w);
        nl_w.setName(ADMIN_LISTENER_NAME);
        nl_w.setProtocol(adminListenerProtocolName);
        nl_w.setPort(ASADMIN_LISTENER_PORT);
        nl_w.setTransport(ASADMIN_LISTENER_TRANSPORT);
        nl_w.setThreadPool(ASADMIN_LISTENER_THREADPOOL);
        return nl_w;
    }
View Full Code Here

    }
   
    void initRest() {
        InputStream is = null;
        try {
            NetworkListener nl = domain.getServerNamed("server").getConfig().getNetworkConfig()
                    .getNetworkListener("admin-listener");
            SecureAdmin secureAdmin = habitat.getService(SecureAdmin.class);

            URL url = new URL(
                    (SecureAdmin.Util.isEnabled(secureAdmin) ? "https" : "http"),
                    nl.getAddress(),
                    Integer.parseInt(nl.getPort()),
                    "/management/domain");
            URLConnection conn = url.openConnection();
            is = conn.getInputStream();
            isRestStarted = true;
        } catch (Exception ex) {
View Full Code Here

            for (String listenerName : networkListenerNames) {
                if (listenerName == null || listenerName.isEmpty()) {
                    continue;
                }

                NetworkListener listener = config.getNetworkConfig().getNetworkListener(listenerName.trim());

                if (secure == Boolean.valueOf(listener.findHttpProtocol().getSecurityEnabled())) {
                    return listener.getPort();
                }
            }
        } catch (Throwable t) {
            // error condition handled in wsit code
            if (logger.isLoggable(Level.FINEST)) {
View Full Code Here

                            if (oneHost.getHost() != null && "localhost".equals(oneHost.getHost())) {
                                jmsHost = "0.0.0.0";
                            } else {
                                jmsHost = oneHost.getHost();
                            }
                            NetworkListener dummy = new DummyNetworkListener();
                            dummy.setPort(oneHost.getPort());
                            dummy.setAddress(jmsHost);
                            dummy.setProtocol("light-weight-listener");
                            dummy.setTransport("tcp");
                            dummy.setName(JMS_SERVICE);
                            grizzlyService.createNetworkProxy(dummy);
                            grizzlyListenerInit = true;
                        }
                    }
                }
View Full Code Here

    }
   
    void initRest() {
        InputStream is = null;
        try {
            NetworkListener nl = domain.getServerNamed("server").getConfig().getNetworkConfig()
                    .getNetworkListener("admin-listener");
            SecureAdmin secureAdmin = habitat.getService(SecureAdmin.class);

            URL url = new URL(
                    (SecureAdmin.Util.isEnabled(secureAdmin) ? "https" : "http"),
                    nl.getAddress(),
                    Integer.parseInt(nl.getPort()),
                    "/management/domain");
            URLConnection conn = url.openConnection();
            is = conn.getInputStream();
            isRestStarted = true;
        } catch (Exception ex) {
View Full Code Here

                        + "must be supplied as a property in the provider-config "
                        + "in the domain.xml file!");
            }
            ServiceLocator habitat = SecurityServicesUtil.getInstance().getHabitat();
            Domain domain = habitat.getService(Domain.class);
            NetworkListener adminListener = domain.getServerNamed("server").getConfig().getNetworkConfig().getNetworkListener("admin-listener");
            SecureAdmin secureAdmin = habitat.getService(SecureAdmin.class);
           
            final String host = adminListener.getAddress();
            // Save the REST URL we need to authenticate the user.
            this.restURL =  (SecureAdmin.Util.isEnabled(secureAdmin) ? "https://" : "http://") +
                    (host.equals("0.0.0.0") ? "localhost" : host) + ":" + adminListener.getPort() + "/management/sessions";
        }
    }
View Full Code Here

                        + "must be supplied as a property in the provider-config "
                        + "in the domain.xml file!");
            }
            ServiceLocator habitat = SecurityServicesUtil.getInstance().getHabitat();
            Domain domain = habitat.getService(Domain.class);
            NetworkListener adminListener = domain.getServerNamed("server").getConfig().getNetworkConfig().getNetworkListener("admin-listener");

            if (restURL.contains(TOKEN_ADMIN_LISTENER_PORT)) {
                restURL = restURL.replace(TOKEN_ADMIN_LISTENER_PORT, adminListener.getPort());
            }

      String host = adminListener.getAddress();
      if (! ("localhost".equals(host) || "0.0.0.0".equals(host))){
                restURL = restURL.replace("localhost", adminListener.getAddress());
            }

            //If secure admin is enabled, we need to ensure using https
            SecureAdmin secureAdmin = habitat.getService(SecureAdmin.class);
            if (restURL.startsWith("http:") && (SecureAdmin.Util.isEnabled(secureAdmin))) {
View Full Code Here

TOP

Related Classes of org.glassfish.grizzly.config.dom.NetworkListener

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.