admin@glassfish.java.net

code review for fixing issue# 3714

From: Anissa Lam <Anissa.Lam_at_Sun.COM>
Date: Tue, 02 Oct 2007 16:17:42 -0700

Please review the changes for fixing issue# 3714.

This is different from the one i sent out yesterday as we don't want to
force user to enter server-name for HTTP-Listener even though it is a
required attribute. User should be able to leave the field empty, and
default it to "" (empty string).

- changes in httpListener.inc
    There is another variable with the same name 'serverName' stored in
the session. For the local variable of the page, we need to specify
the scope, ie requestScope so that the value will not be coming from
the session variable map.

- changes in JmxHandlers.java
   Pass an " " (with a space) to backend so that server-name will be
writen out as "" empty string in domain.xml

thanks
Anissa




Index: JmxHandlers.java
===================================================================
RCS file: /cvs/glassfish/admin-gui/src/java/com/sun/enterprise/tools/admingui/handlers/JmxHandlers.java,v
retrieving revision 1.9.4.1
diff -u -r1.9.4.1 JmxHandlers.java
--- JmxHandlers.java 13 Sep 2007 14:54:14 -0000 1.9.4.1
+++ JmxHandlers.java 2 Oct 2007 23:10:46 -0000
@@ -461,12 +461,17 @@
                         int port = Integer.parseInt((String)props.get("port"));
                         String vs = (String) props.get("virtualServer");
                         String httpName = (String) props.get("httpName");
+ String serverName = (String)props.get("serverName");
+ //issue 3714. we need to pass in a String with a space, instead of empty string so backend will take it.
+ //server-name is allowed to be empty. see admin-core/admin/dtds/admin-mbeans-descriptors.xml
+ if (GuiUtil.isEmpty(serverName))serverName = " ";
+
                         HTTPListenerConfig httpConfig = config.getHTTPServiceConfig().createHTTPListenerConfig(
                                 httpName,
                                 (String) props.get("address"),
                                 port,
                                 vs,
- (String) props.get("serverName"),
+ serverName,
                                 options);
                         httpConfig.setEnabled((Boolean)props.get("enabled"));
                         httpConfig.setSecurityEnabled((Boolean)props.get("securityEnabled"));


Index: httpListener.inc
===================================================================
RCS file: /cvs/glassfish/admin-gui/src/docroot/configuration/httpListener.inc,v
retrieving revision 1.7.8.1
diff -u -r1.7.8.1 httpListener.inc
--- httpListener.inc 13 Sep 2007 14:53:11 -0000 1.7.8.1
+++ httpListener.inc 2 Oct 2007 23:12:59 -0000
@@ -53,7 +53,7 @@
             NetwkAddr="#{netwkAddr}"
             ListenerPort="#{listenerPort}"
             DefaultVirtServer="#{defaultVirtServer}"
- ServerName="#{serverName}"
+ ServerName="#{requestScope.serverName}"
             Listener="#{listener}"
             security="#{security}"
             RedirectPort="#{redirectPort}"
@@ -79,7 +79,7 @@
             NetwkAddr="#{netwkAddr}"
             ListenerPort="#{listenerPort}"
             DefaultVirtServer="#{defaultVirtServer}"
- ServerName="#{serverName}"
+ ServerName="#{requestScope.serverName}"
             Listener="#{listener}"
             security="#{security}"
             RedirectPort="#{redirectPort}"