Search in sources :

Example 16 with Protocols

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

the class WebContainerImpl method removeListener.

private void removeListener(String name) {
    try {
        NetworkListeners networkListeners = networkConfig.getNetworkListeners();
        final NetworkListener listenerToBeRemoved = networkConfig.getNetworkListener(name);
        final Protocols protocols = networkConfig.getProtocols();
        final Protocol protocol = networkConfig.findProtocol(name);
        if (listenerToBeRemoved == null) {
            log.severe("Network Listener " + name + " doesn't exist");
        } else {
            final com.sun.enterprise.config.serverbeans.VirtualServer virtualServer = httpService.getVirtualServerByName(listenerToBeRemoved.findHttpProtocol().getHttp().getDefaultVirtualServer());
            ConfigSupport.apply(new ConfigCode() {

                public Object run(ConfigBeanProxy... params) throws PropertyVetoException {
                    final NetworkListeners listeners = (NetworkListeners) params[0];
                    final com.sun.enterprise.config.serverbeans.VirtualServer server = (com.sun.enterprise.config.serverbeans.VirtualServer) params[1];
                    listeners.getNetworkListener().remove(listenerToBeRemoved);
                    server.removeNetworkListener(listenerToBeRemoved.getName());
                    return listenerToBeRemoved;
                }
            }, networkListeners, virtualServer);
            ConfigSupport.apply(new ConfigCode() {

                public Object run(ConfigBeanProxy... params) throws PropertyVetoException {
                    final Protocols protocols = (Protocols) params[0];
                    final Protocol protocol = (Protocol) params[1];
                    protocols.getProtocol().remove(protocol);
                    return protocol;
                }
            }, protocols, protocol);
        }
    } catch (TransactionFailure e) {
        log.severe("Remove listener " + name + " failed " + e.getMessage());
    }
}
Also used : Protocols(org.glassfish.grizzly.config.dom.Protocols) VirtualServer(org.glassfish.embeddable.web.VirtualServer) PropertyVetoException(java.beans.PropertyVetoException) NetworkListeners(org.glassfish.grizzly.config.dom.NetworkListeners) Protocol(org.glassfish.grizzly.config.dom.Protocol) org.jvnet.hk2.config(org.jvnet.hk2.config) NetworkListener(org.glassfish.grizzly.config.dom.NetworkListener)

Aggregations

Protocols (org.glassfish.grizzly.config.dom.Protocols)16 Protocol (org.glassfish.grizzly.config.dom.Protocol)15 Config (com.sun.enterprise.config.serverbeans.Config)12 TransactionFailure (org.jvnet.hk2.config.TransactionFailure)12 CommandTarget (org.glassfish.config.support.CommandTarget)10 Target (org.glassfish.internal.api.Target)10 NetworkListener (org.glassfish.grizzly.config.dom.NetworkListener)7 ActionReport (org.glassfish.api.ActionReport)6 NetworkConfig (org.glassfish.grizzly.config.dom.NetworkConfig)6 PropertyVetoException (java.beans.PropertyVetoException)5 List (java.util.List)4 Http (org.glassfish.grizzly.config.dom.Http)4 NetworkListeners (org.glassfish.grizzly.config.dom.NetworkListeners)3 ArrayList (java.util.ArrayList)2 VirtualServer (org.glassfish.embeddable.web.VirtualServer)2 PortUnification (org.glassfish.grizzly.config.dom.PortUnification)2 ProtocolChain (org.glassfish.grizzly.config.dom.ProtocolChain)2 ProtocolChainInstanceHandler (org.glassfish.grizzly.config.dom.ProtocolChainInstanceHandler)2 ProtocolFilter (org.glassfish.grizzly.config.dom.ProtocolFilter)2 ProtocolFinder (org.glassfish.grizzly.config.dom.ProtocolFinder)2