Package org.glassfish.grizzly.config.dom

Examples of org.glassfish.grizzly.config.dom.Protocol$Duck


            config = newConfig;
        }
        final ActionReport report = context.getActionReport();
        // check for duplicates
        Protocols protocols = config.getNetworkConfig().getProtocols();
        Protocol protocol = null;
        for (Protocol p : protocols.getProtocol()) {
            if(protocolName.equals(p.getName())) {
                protocol = p;
            }
        }
        if (protocol == null) {
            report.setMessage(localStrings.getLocalString("create.http.redirect.fail.protocolnotfound",
                "The specified protocol {0} is not yet configured. Please create one", protocolName));
            report.setActionExitCode(ActionReport.ExitCode.FAILURE);
            return;
        }
        if (protocol.getHttpRedirect() != null) {
            report.setMessage(localStrings.getLocalString("create.http.redirect.fail.duplicate",
                "An http-redirect element for {0} already exists. Cannot add duplicate http-redirect", protocolName));
            report.setActionExitCode(ActionReport.ExitCode.FAILURE);
            return;
        }
View Full Code Here


                }
                addChangeListener(listener);
                addChangeListener(listener.findThreadPool());
                addChangeListener(listener.findTransport());

                final Protocol protocol = listener.findHttpProtocol();
                if (protocol != null) {
                    addChangeListener(protocol);
                    addChangeListener(protocol.getHttp());
                    addChangeListener(protocol.getHttp().getFileCache());
                    addChangeListener(protocol.getSsl());
                }
            }

            future = proxy.start();
View Full Code Here

            config = newConfig;
        }
        final ActionReport report = context.getActionReport();
        NetworkConfig networkConfig = config.getNetworkConfig();
        Protocols protocols = networkConfig.getProtocols();
        Protocol protocol = null;
        for (Protocol p : protocols.getProtocol()) {
            if (protocolName.equalsIgnoreCase(p.getName())) {
                protocol = p;
            }
        }
        if (protocol == null) {
            report.setMessage(String.format("Unable to find protocol %s.", protocolName));
            report.setActionExitCode(ActionReport.ExitCode.FAILURE);
            return;
        }
        final Http http = protocol.getHttp();
        if (http == null) {
            report.setMessage(String.format("Protocol, %s, is not an HTTP enabled protocol.", protocolName));
            report.setActionExitCode(ActionReport.ExitCode.FAILURE);
            return;
        }

        try {
            final String strategyName = SameThreadIOStrategy.class.getName();
            Transport spdyTransport = null;

            final List<NetworkListener> networkListeners =
                    protocol.findNetworkListeners();
            for (NetworkListener networkListener : networkListeners) {
                final Transport transport = networkListener.findTransport();
                if (transport != null &&
                        !strategyName.equals(transport.getIoStrategy())) {
                    if (spdyTransport == null) {
View Full Code Here

    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(
                                            CREATE_SSL_HTTP_ALREADY_EXISTS, command.listenerId)));
View Full Code Here

                            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;
View Full Code Here

            config = newConfig;
        }
        report = context.getActionReport();
        try {
            final Protocols protocols = config.getNetworkConfig().getProtocols();
            final Protocol protocol = protocols.findProtocol(protocolName);
            validate(protocol, CreateHttp.CREATE_HTTP_FAIL_PROTOCOL_NOT_FOUND, protocolName);
            PortUnification pu = getPortUnification(protocol);
            ConfigSupport.apply(new ConfigCode() {
                @Override
                public Object run(ConfigBeanProxy... params) {
                    final Protocol prot = (Protocol) params[0];
                    final PortUnification portUnification = (PortUnification) params[1];

                    final List<ProtocolFinder> oldList = portUnification.getProtocolFinder();
                    List<ProtocolFinder> newList = new ArrayList<ProtocolFinder>();
                    for (final ProtocolFinder finder : oldList) {
                        if (!name.equals(finder.getName())) {
                            newList.add(finder);
                        }
                    }
                    if (oldList.size() == newList.size()) {
                        throw new RuntimeException(
                            String.format("No finder named %s found for protocol %s", name, protocolName));
                    }
                    if(newList.isEmpty()) {
                        prot.setPortUnification(null);
                    } else {
                        portUnification.setProtocolFinder(newList);
                    }
                    return null;
                }
View Full Code Here

                }
                addChangeListener(listener);
                addChangeListener(listener.findThreadPool());
                addChangeListener(listener.findTransport());

                final Protocol protocol = listener.findHttpProtocol();
                if (protocol != null) {
                    addChangeListener(protocol);
                    addChangeListener(protocol.getHttp());
                    addChangeListener(protocol.getHttp().getFileCache());
                    addChangeListener(protocol.getSsl());
                }
            }

            future = proxy.start();
View Full Code Here

        return (int) Long.parseLong(getAdminListener().getPort());
    }

    private String get_asadmin()
    {
        final Protocol protocol = networkConfig().getProtocols().findProtocol(ADMIN_LISTENER_NAME);
        return protocol.getHttp().getDefaultVirtualServer();
    }
View Full Code Here

        return protocol.getHttp().getDefaultVirtualServer();
    }

    public String getRESTBaseURL() throws MalformedURLException
    {
        final Protocol protocol = networkConfig().getProtocols().findProtocol(ADMIN_LISTENER_NAME);
        final String scheme = Boolean.parseBoolean(protocol.getSecurityEnabled()) ? "https" : "http";
        final String host = "localhost";
        URL url = new URL(scheme, host, getRESTPort(), "/" + get_asadmin());
        return url.toString() + "/";
    }
View Full Code Here

         *         <ssl ...>
         *
         */
         final Config serverConfig;
         final NetworkConfig nc;
         final Protocol p;
         final Ssl ssl ;
         if ((serverConfig = configs.getConfigByName(SecureAdminUpgradeHelper.DAS_CONFIG_NAME)) == null) {
             return false;
         }

         if ((nc = serverConfig.getNetworkConfig()) == null) {
             return false;
         }

         if ((p = nc.findProtocol(ADMIN_LISTENER_NAME)) == null) {
             return false;
         }

        
         if ((ssl = p.getSsl()) == null) {
             return false;
         }
         return true;
    }
View Full Code Here

TOP

Related Classes of org.glassfish.grizzly.config.dom.Protocol$Duck

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.