dev@glassfish.java.net

Is this a bug or did I just misinterpret the set-web-env-entry command?

From: Vince Kraemer <vince.kraemer_at_oracle.com>
Date: Mon, 17 Jun 2013 21:42:24 -0700

I have deployed a web app that uses an env-entry. The name of the entry
is EnvEntryName. The value is a String, "EnvEntryValue"... very
original huh...

Lets take a look at the output from the app "originally"

vbkmbp:~ vkraemer$ curl
http://localhost:8080/AppWithEnvEntryAndContextParam6/NewServlet
<!DOCTYPE html>
<html>
<head>
<title>Servlet NewServlet</title>
</head>
<body>
<h1>Servlet NewServlet at /AppWithEnvEntryAndContextParam6</h1>
<h2>Env: EnvEntryValue</h2>
<h2>Context-Param: ParamValue</h2>
<h2>Init-Param: InitParamValue</h2>
</body>
</html>

Sweet.

Now... we run the following command...

vbkmbp:~ vkraemer$ /Applications/NetBeans/glassfish-4.0/bin/asadmin
set-web-env-entry --name EnvEntryName --value NewEnvEntryValue --type
java.lang.String --ignoredescriptoritem=false
AppWithEnvEntryAndContextParam6
Command set-web-env-entry executed successfully.


If I rerun the 'curl'... I get the same output as I got BEFORE I ran the
command.

If I restart the domain... I see this...

vbkmbp:~ vkraemer$ /Applications/NetBeans/glassfish-4.0/bin/asadmin
restart-domain domain1
Successfully restarted the domain
Command restart-domain executed successfully.
vbkmbp:~ vkraemer$ curl
http://localhost:8080/AppWithEnvEntryAndContextParam6/NewServlet
<!DOCTYPE html>
<html>
<head>
<title>Servlet NewServlet</title>
</head>
<body>
<h1>Servlet NewServlet at /AppWithEnvEntryAndContextParam6</h1>
<h2>Env: NewEnvEntryValue</h2>
<h2>Context-Param: ParamValue</h2>
<h2>Init-Param: InitParamValue</h2>
</body>
</html>

I will be honest... I would have expected the env-entry-value to have
changed without a restart of the domain.

requiring a restart seems to be a strong limitation of the value of the
set-web-env-entry command.

note: set-web-context-param seems to suffer a similar 'fate'....

vbkmbp:~ vkraemer$ curl
http://localhost:8080/AppWithEnvEntryAndContextParam6/NewServlet
<!DOCTYPE html>
<html>
<head>
<title>Servlet NewServlet</title>
</head>
<body>
<h1>Servlet NewServlet at /AppWithEnvEntryAndContextParam6</h1>
<h2>Env: NewEnvEntryValue</h2>
<h2>Context-Param: ParamValue</h2>
<h2>Init-Param: InitParamValue</h2>
</body>
</html>

vbkmbp:~ vkraemer$ /Applications/NetBeans/glassfish-4.0/bin/asadmin
set-web-context-param --value NewParamValue
AppWithEnvEntryAndContextParam6Enter the value for the name option>
ParamName
Command set-web-context-param executed successfully.

vbkmbp:~ vkraemer$ curl
http://localhost:8080/AppWithEnvEntryAndContextParam6/NewServlet
<!DOCTYPE html>
<html>
<head>
<title>Servlet NewServlet</title>
</head>
<body>
<h1>Servlet NewServlet at /AppWithEnvEntryAndContextParam6</h1>
<h2>Env: NewEnvEntryValue</h2>
<h2>Context-Param: ParamValue</h2>
<h2>Init-Param: InitParamValue</h2>
</body>
</html>

vbkmbp:~ vkraemer$ /Applications/NetBeans/glassfish-4.0/bin/asadmin
restart-domain domain1
Successfully restarted the domain
Command restart-domain executed successfully.

vbkmbp:~ vkraemer$ curl
http://localhost:8080/AppWithEnvEntryAndContextParam6/NewServlet
<!DOCTYPE html>
<html>
<head>
<title>Servlet NewServlet</title>
</head>
<body>
<h1>Servlet NewServlet at /AppWithEnvEntryAndContextParam6</h1>
<h2>Env: NewEnvEntryValue</h2>
<h2>Context-Param: NewParamValue</h2>
<h2>Init-Param: InitParamValue</h2>
</body>
</html>

Thanks,
vbk