Package org.glassfish.grizzly.config.dom

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


                        + "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


                listenerId));
            report.setActionExitCode(ExitCode.FAILURE);
            return;
        }
        try {
            NetworkListener ls = networkConfig.getNetworkListener(listenerId);
            final String name = ls.getProtocol();
            VirtualServer vs = config.getHttpService()
                .getVirtualServerByName(ls.findHttpProtocol().getHttp().getDefaultVirtualServer());
            ConfigSupport.apply(new DeleteNetworkListener(), networkConfig.getNetworkListeners());
            ConfigSupport.apply(new UpdateVirtualServer(), vs);
            cleanUp(name);
            report.setActionExitCode(ExitCode.SUCCESS);
        } catch (TransactionFailure e) {
View Full Code Here

    @Override
    public void create(final CreateSsl command, ActionReport report) {

        NetworkConfig netConfig = command.config.getNetworkConfig();
        // ensure we have the specified listener
        NetworkListener listener = netConfig.getNetworkListener(command.listenerId);
        Protocol httpProtocol;
        try {
            if (listener == null) {
                report.setMessage(
                        localStrings.getLocalString("create.ssl.http.notfound",
                                "Network Listener named {0} does not exist.  Creating or using the named protocol element instead.",
                                command.listenerId));
                httpProtocol = command.findOrCreateProtocol(command.listenerId);
            } else {
                httpProtocol = listener.findHttpProtocol();
                Ssl ssl = httpProtocol.getSsl();
                if (ssl != null) {
                    report.setMessage(localStrings.getLocalString("create.ssl.http.alreadyExists",
                        "Network Listener named {0} to which this ssl element is being added already has an ssl element.",
                        command.listenerId));
View Full Code Here

    @Override
    public void delete(DeleteSsl command, ActionReport report) {

        NetworkConfig netConfig = command.config.getNetworkConfig();
        NetworkListener networkListener =
            netConfig.getNetworkListener(command.listenerId);

        if (networkListener == null) {
            report.setMessage(localStrings.getLocalString(
                "delete.ssl.http.listener.notfound",
                "HTTP Listener named {0} not found", command.listenerId));
            report.setActionExitCode(ActionReport.ExitCode.FAILURE);
            return;
        }

        Protocol protocol = networkListener.findHttpProtocol();
        if (protocol.getSsl() == null) {
            report.setMessage(localStrings.getLocalString(
                "delete.ssl.element.doesnotexist", "Ssl element does " +
                "not exist for Listener named {0}", command.listenerId));
            report.setActionExitCode(ActionReport.ExitCode.FAILURE);
            return;
        }

        try {
            ConfigSupport.apply(new SingleConfigCode<Protocol>() {
                public Object run(Protocol param) {
                    param.setSsl(null);
                    return null;
                }
            }, networkListener.findHttpProtocol());
        } catch(TransactionFailure e) {
            command.reportError(report, e);
        }
    }
View Full Code Here

            @ProbeParam("address") String address) {
        for (String listener : networkListeners) {
            if (listener.equals(listenerName)) {
                countOpenConnections.increment();
            }
            NetworkListener networkListener = networkConfig.getNetworkListener(listenerName);
            if (networkListener != null) {
                maxOpenConnections.setCount(
                        Integer.valueOf(networkListener.findProtocol().getHttp().getMaxConnections()));
            }
        }
        if (logger.isLoggable(Level.FINEST)) {
            logger.finest(
                "[TM]connectionAcceptedEvent received - virtual-server = " + listenerName);
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

    @Override
    public void create(final CreateSsl command, ActionReport report) {

        NetworkConfig netConfig = command.config.getNetworkConfig();
        // ensure we have the specified listener
        NetworkListener listener = netConfig.getNetworkListener(command.listenerId);
        Protocol httpProtocol;
        try {
            if (listener == null) {
                report.setMessage(
                        WebContainer.rb.getString(
                                MessageFormat.format(
                                        CREATE_SSL_HTTP_NOT_FOUND, command.listenerId)));
                httpProtocol = command.findOrCreateProtocol(command.listenerId);
            } else {
                httpProtocol = listener.findHttpProtocol();
                Ssl ssl = httpProtocol.getSsl();
                if (ssl != null) {
                    report.setMessage(
                            WebContainer.rb.getString(
                                    MessageFormat.format(
View Full Code Here

    @Override
    public void delete(DeleteSsl command, ActionReport report) {

        NetworkConfig netConfig = command.config.getNetworkConfig();
        NetworkListener networkListener =
            netConfig.getNetworkListener(command.listenerId);

        if (networkListener == null) {
            report.setMessage(
                    WebContainer.rb.getString(
                            MessageFormat.format(DELETE_SSL_HTTP_LISTENER_NOT_FOUND, command.listenerId)));
            report.setActionExitCode(ActionReport.ExitCode.FAILURE);
            return;
        }

        Protocol protocol = networkListener.findHttpProtocol();
        if (protocol.getSsl() == null) {
            report.setMessage(
                    WebContainer.rb.getString(
                            MessageFormat.format(DELETE_SSL_ELEMENT_DOES_NOT_EXIST, command.listenerId)));
            report.setActionExitCode(ActionReport.ExitCode.FAILURE);
            return;
        }

        try {
            ConfigSupport.apply(new SingleConfigCode<Protocol>() {
                public Object run(Protocol param) {
                    param.setSsl(null);
                    return null;
                }
            }, networkListener.findHttpProtocol());
        } catch(TransactionFailure e) {
            command.reportError(report, e);
        }
    }
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
            logger.log(Level.FINEST, "Exception occurred retrieving port configuration for WSTX service", t);
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

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.