Search in sources :

Example 41 with Protocol

use of org.glassfish.grizzly.config.dom.Protocol in project Payara by payara.

the class GrizzlyService method createNetworkProxy.

/*
     * Creates a new NetworkProxy for a particular HttpListner
     * @param listener NetworkListener
     * @param networkConfig HttpService
     */
public synchronized Future<Result<Thread>> createNetworkProxy(NetworkListener listener) {
    if (!Boolean.valueOf(listener.getEnabled())) {
        // in case the listener will be enabled
        addChangeListener(listener);
        LOGGER.log(Level.INFO, KernelLoggerInfo.grizzlyPortDisabled, new Object[] { listener.getName(), listener.getPort() });
        return null;
    }
    // create the proxy for the port.
    GrizzlyProxy proxy = new GrizzlyProxy(this, listener);
    Future<Result<Thread>> future = null;
    try {
        proxy.initialize();
        if (!isLightWeightListener(listener)) {
            final NetworkConfig networkConfig = listener.getParent(NetworkListeners.class).getParent(NetworkConfig.class);
            // attach all virtual servers to this port
            for (VirtualServer vs : networkConfig.getParent(Config.class).getHttpService().getVirtualServer()) {
                List<String> vsListeners = StringUtils.parseStringList(vs.getNetworkListeners(), " ,");
                if (vsListeners == null || vsListeners.isEmpty() || vsListeners.contains(listener.getName())) {
                    if (!hosts.contains(vs.getId())) {
                        hosts.add(vs.getId());
                    }
                }
            }
            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();
        // add the new proxy to our list of proxies.
        proxies.add(proxy);
    } catch (Throwable e) {
        final Future<Result<Thread>> errorFuture = Futures.createReadyFuture(new Result<Thread>(e));
        future = errorFuture;
    } finally {
        if (future == null) {
            final FutureImpl<Result<Thread>> errorFuture = Futures.<Result<Thread>>createUnsafeFuture();
            errorFuture.result(new Result<Thread>(new IllegalStateException("Unexpected error")));
            future = errorFuture;
        }
        futures.add(future);
    }
    return future;
}
Also used : NetworkConfig(org.glassfish.grizzly.config.dom.NetworkConfig) VirtualServer(com.sun.enterprise.config.serverbeans.VirtualServer) Result(com.sun.enterprise.util.Result) NetworkListeners(org.glassfish.grizzly.config.dom.NetworkListeners) Future(java.util.concurrent.Future) Protocol(org.glassfish.grizzly.config.dom.Protocol)

Example 42 with Protocol

use of org.glassfish.grizzly.config.dom.Protocol in project Payara by payara.

the class SSLConfigurator method logEmptyWarning.

protected void logEmptyWarning(Ssl ssl, final String msg) {
    final StringBuilder name = new StringBuilder();
    for (NetworkListener listener : ((Protocol) ssl.getParent()).findNetworkListeners()) {
        if (name.length() != 0) {
            name.append(", ");
        }
        name.append(listener.getName());
    }
    LOGGER.log(Level.FINE, msg, name.toString());
}
Also used : Protocol(org.glassfish.grizzly.config.dom.Protocol) NetworkListener(org.glassfish.grizzly.config.dom.NetworkListener)

Aggregations

Protocol (org.glassfish.grizzly.config.dom.Protocol)42 Config (com.sun.enterprise.config.serverbeans.Config)22 TransactionFailure (org.jvnet.hk2.config.TransactionFailure)18 NetworkListener (org.glassfish.grizzly.config.dom.NetworkListener)16 CommandTarget (org.glassfish.config.support.CommandTarget)15 Target (org.glassfish.internal.api.Target)15 Protocols (org.glassfish.grizzly.config.dom.Protocols)14 NetworkConfig (org.glassfish.grizzly.config.dom.NetworkConfig)12 ActionReport (org.glassfish.api.ActionReport)11 Http (org.glassfish.grizzly.config.dom.Http)9 PropertyVetoException (java.beans.PropertyVetoException)7 Ssl (org.glassfish.grizzly.config.dom.Ssl)7 List (java.util.List)6 VirtualServer (com.sun.enterprise.config.serverbeans.VirtualServer)5 NetworkListeners (org.glassfish.grizzly.config.dom.NetworkListeners)5 ArrayList (java.util.ArrayList)4 PortUnification (org.glassfish.grizzly.config.dom.PortUnification)4 ProtocolChain (org.glassfish.grizzly.config.dom.ProtocolChain)4 ProtocolFinder (org.glassfish.grizzly.config.dom.ProtocolFinder)4 ConfigBeanProxy (org.jvnet.hk2.config.ConfigBeanProxy)4