Sun GlassFish Enterprise Server v3 Application Deployment Guide

Modifying the Configuration of a Web Application or Module

You can modify the configuration of a web application or a module by modifying the deployment descriptors and then repackaging and redeploying the application.

The instructions in this section enable you to change the configuration of a deployed application without the need to modify the application's deployment descriptors and repackage and redeploy the application. If the application or module entry is unset, its value reverts to the value, if any, that is set in the application's deployment descriptor.

The following topics are addressed here:

ProcedureTo Set a Web Context Parameter

Use the set-web-context-param subcommand in remote mode to change the configuration of a deployed application without the need to modify the application's deployment descriptors and repackage and redeploy the application. By using this subcommand, you are either adding a new parameter that did not appear in the original web module's descriptor, or overriding the descriptor's setting of the parameter.

If the --ignoreDescriptorItem option is set to true, then the server ignores any setting for that context parameter in the descriptor, which means you do not need to specify an overriding value on the set-web-context-param subcommand. The server behaves as if the descriptor had never contained a setting for that context parameter.

This subcommand sets a servlet context-initialization parameter of one of the following items:

Before You Begin

The application must already be deployed. Otherwise, an error occurs.

  1. Ensure that the server is running.

    Remote commands require a running server.

  2. Set a servlet context-initialization parameter by using the set-web-context-param(1) subcommand.

    Information about the options for the subcommand is included in this help page.


Example 2–21 Setting a Servlet Context-Initialization Parameter for a Web Application

This example sets the servlet context-initialization parameter javax.faces.STATE_SAVING_METHOD of the web application basic-ezcomp to client.


asadmin> set-web-context-param --name=javax.faces.STATE_SAVING_METHOD
--description="The location where the application?s state is preserved"
--value=client basic-ezcomp
Command set-web-context-param executed successfully.

See Also

You can also view the full syntax and options of the subcommand by typing asadmin help set-web-context-param at the command line.

ProcedureTo Unset a Web Context Parameter

Use the unset-web-context-param subcommand in remote mode to unset an environment entry for a deployed web application or module that has been set by using the set-web-env-entry subcommand. There is no need to modify the application's deployment descriptors and repackage and redeploy the application.

This subcommand unsets an environment entry for one of the following items:

When an entry is unset, its value reverts to the value, if any, that is set in the application's deployment descriptor. This subcommand cannot be used to change the value of an environment entry that is set in an application's deployment descriptor. Instead, use the set-web-context-param(1) subcommand for this purpose.

Before You Begin

The application must already be deployed, and the entry must have previously been set by using the set-web-env-entry subcommand. Otherwise, an error occurs.

  1. Ensure that the server is running.

    Remote commands require a running server.

  2. Unset an environment entry by using the unset-web-context-param(1) subcommand.

    Information about the options for the subcommand is included in this help page.


Example 2–22 Unsetting a Servlet Context-Initialization Parameter for a Web Application

This example unsets the servlet context-initialization parameter javax.faces.STATE_SAVING_METHOD of the web application basic-ezcomp.


asadmin> unset-web-context-param
--name=javax.faces.STATE_SAVING_METHOD basic-ezcomp
Command unset-web-context-param executed successfully.

See Also

You can also view the full syntax and options of the subcommand by typing asadmin help unset-web-context-param at the command line.

ProcedureTo List Web Context Parameters

Use the list-web-context-param subcommand in remote mode to list the parameters that have previously been set by using the set-web-context-param(1) subcommand. The subcommand does not list parameters that are set only in the application's deployment descriptor. For each parameter, the following information is displayed:

  1. Ensure that the server is running.

    Remote commands require a running server.

  2. List servlet context-initialization parameters by using the list-web-context-param(1) subcommand.


Example 2–23 Listing Servlet Context-Initialization Parameters for a Web Application

This example lists all servlet context-initialization parameters of the web application basic-ezcomp that have been set by using the set-web-context-param subcommand. Because no description was specified when the javax.faces.PROJECT_STAGE parameter was set, null is displayed instead of a description for this parameter.


asadmin> list-web-context-param basic-ezcomp
javax.faces.STATE_SAVING_METHOD = client ignoreDescriptorItem=false
//The location where the application?s state is preserved
javax.faces.PROJECT_STAGE = null ignoreDescriptorItem=true //null
Command list-web-context-param executed successfully.

See Also

You can also view the full syntax and options of the subcommand by typing asadmin help list-web-context-param at the command line.

ProcedureTo Set a Web Environment Entry

An application uses the values of environment entries to customize its behavior or presentation. Use the set-web-env-entry subcommand in remote mode to change the configuration of a deployed application without the need to modify the application's deployment descriptors and repackage and redeploy the application. By using this subcommand, you are either adding a new parameter that did not appear in the original web module's descriptor, or overriding the descriptor's setting of the parameter.

If you the --ignoreDescriptorItem option is set to true, then the server ignores any setting for that environment entry in the descriptor, which means you do not need to specify an overriding value on the set-web-env-entry subcommand. The server behaves as if the descriptor had never contained a setting for that environment entry.

This subcommand sets an environment entry for one of the following items:

Before You Begin

The application must already be deployed. Otherwise, an error occurs.

  1. Ensure that the server is running.

    Remote commands require a running server.

  2. Set an environment entry for a deployed web application or module by using the set-web-env-entry(1) subcommand.

    Information about the options for the subcommand is included in this help page.


Example 2–24 Setting an Environment Entry for a Web Application

This example sets the environment entry Hello User of the application hello to techscribe. The Java type of this entry is java.lang.String.


asadmin> set-web-env-entry --name="Hello User"
--type=java.lang.String --value=techscribe
--description="User authentication for Hello appplication" hello
Command set-web-env-entry executed successfully

See Also

You can also view the full syntax and options of the subcommand by typing asadmin help set-web-env-entry at the command line.

ProcedureTo Unset a Web Environment Entry

Use the unset-web-env-entry subcommand in remote mode to unset an environment entry for a deployed web application or module.

  1. Ensure that the server is running.

    Remote commands require a running server.

  2. Unset a web environment entry by using the unset-web-env-entry(1) subcommand.

    Information about the options for the subcommand is included in this help page.


Example 2–25 Unsetting an Environment Entry for a Web Application

This example unsets the environment entry Hello User of the web application hello.


asadmin> unset-web-env-entry --name="Hello User" hello
Command unset-web-env-entry executed successfully.

See Also

You can also view the full syntax and options of the subcommand by typing asadmin help unset-web-env-entry at the command line.

ProcedureTo List Web Environment Entries

Use the list-web-env-entry subcommand to list environment entries for a deployed web application or module. For each entry, the following information is displayed:

  1. Ensure that the server is running.

    Remote commands require a running server.

  2. List the environment entries by using thelist-web-env-entry(1) subcommand.


Example 2–26 Listing Environment Entries for a Web Application

This example lists all environment entries that have been set for the web application hello by using the set-web-env-entry subcommand.


asadmin> list-web-env-entry hello
Hello User (java.lang.String) = techscribe ignoreDescriptorItem=false
//User authentication for Hello appplication
Hello Port (java.lang.Integer) = null ignoreDescriptorItem=true //null
Command list-web-env-entry executed successfully.

See Also

You can also view the full syntax and options of the subcommand by typing asadmin help list-web-env-entry at the command line.