users@glassfish.java.net

Re: How to start the server with a disabled HTTP listener

From: <glassfish_at_javadesktop.org>
Date: Wed, 05 Aug 2009 12:10:41 PDT

Hi Jörg,

>Currently, we use GF v2.1 (and will use v2.1.1 as soon as it is released...)

Here is a code snippet for disabling the HTTP listener using AMX for v2.
You can also look at AMXUtil.java under admingui source code for other example.
https://glassfish.dev.java.net/source/browse/glassfish/admin-gui/src/java/com/sun/enterprise/tools/admingui/util/?only_with_tag=SJSAS91_FCS_BRANCH

You need to know your config name, I am using 'server-config' here
and you also need to provide the Http Listener name, I am using 'http-listener-1'.
Basically you walk down the mbean hierarchy from domain root and get to the bean you want and then get or set the value.

import com.sun.enterprise.admin.common.MBeanServerFactory;
import com.sun.appserv.management.client.ProxyFactory;
import com.sun.appserv.management.config.ConfigConfig;
import com.sun.appserv.management.config.HTTPListenerConfig;

ProxyFactory amxProxyFactory = ProxyFactory.getInstance( MBeanServerFactory.getMBeanServer());
ConfigConfig config = amxProxyFactory.getDomainRoot().getDomainConfig().getConfigConfigMap().get("server-config");
HTTPListenerConfig httpListConfig = config.getHTTPServiceConfig().getHTTPListenerConfigMap().get("http-listener-1");
httpListConfig.setEnabled(false);

Hope this help.
Anissa.
[Message sent by forum member 'anilam' (anilam)]

http://forums.java.net/jive/thread.jspa?messageID=359053