|
|
This appendix provides brief descriptions of the utility Java servlets that are used in an SESM web application. The SESM components include a set of utility Java servlets that the web application uses to perform a variety of common tasks, such as:
Most SESM utility servlets are decorators that extend the Decorator abstract class and are subclasses of the Navigator class. The SESM utility servlets that are decorators have Decorator in their names.
The SESM utility servlets are preprogrammed with specific functionality. They do not require customization, but because they are decorators, you can extend a utility servlet with a post-decorator.
This appendix does not provide descriptions of two specialized sets of servlets: SESM controls and dimension decorators. You can find information on these servlets in the following locations:
All SESM servlet classes including those for dimension decorators and controls are documented in the Javadoc documentation that is installed with the SESM software.
![]() |
Tip A few utility servlets are very helpful for testing and debugging an SESM web application: Snoop, TestDimensionDecorator, LocaleDecorator, and TestUserDecorator. For information on debugging, see the "Debugging an SESM Web Application" section. |
An SESM utility servlet that is a subclass of either Navigator or Decorator can have preDecorate and postDecorate initialization parameters:
| Initialization Parameter | Description |
|---|---|
Specifies a list of names for other decorator servlets that are invoked, in the order listed, before the decorator declared in the | |
Specifies a list of names for other decorator servlets that are invoked, in the order listed, after the decorator declared in the |
Depending on whether a servlet being declared in <servlet-class> is a subclass of Navigator or Decorator, the behavior of the preDecorate and postDecorate initialization parameters is different:
<servlet-class> is a subclass of Navigator, each decorator in the preDecorate list and the postDecorate list is always invoked. Each decorator is called by invoking its decorateIfNecessary method. <servlet-class> is a subclass of Decorator and if the decoration by this servlet is needed, each decorator in the preDecorate list and the postDecorate list is invoked by calling its decorateIfNecessary method. If a pre-decorator or post-decorator throws a ServletException, all decoration stops. No further pre-decorators or post-decorators are invoked. The servlet declared in the <servlet-class> attribute is not invoked if it has not already been called. If the servlet declared in the <servlet-class> attribute throws a ServletException, no post-decorators are invoked.
In the web.xml file, you configure the preDecorate and postDecorate initialization parameters in the servlet declaration. Consider the following declaration for MyAccountView that specifies the VirtualFile servlet:
<servlet>
<servlet-name>MyAccountView</servlet-name>
<servlet-class>com.cisco.sesm.navigator.VirtualFile</servlet-class>
<load-on-startup>1</load-on-startup>
...
<init-param>
<param-name>preDecorate</param-name>
<param-value>User, NoCache</param-value>
</init-param>
</servlet>
In the preceding example, the pre-decorators User and NoCache are invoked by calling their decorateIfNecessary methods. With subclasses of Navigator (such as VirtualFile), the pre-decorators and post-decorators are always invoked. They are called by invoking their decorateIfNecessary methods.
In the next example, the UserDecorator servlet is a subclass of Decorator.
<servlet>
<servlet-name>User</servlet-name>
<servlet-class>
com.cisco.sesm.webapp.decorator.UserDecorator
</servlet-class>
<load-on-startup>1</load-on-startup>
<init-param>
<param-name>postDecorate</param-name>
<param-value>InitUser, RemovePermission, RefreshShape</param-value>
</init-param>
</servlet>
In the preceding example, if decoration by UserDecorator is needed, the post-decorators InitUser, RemovePermission, and NoCache are invoked by calling their decorateIfNecessary methods. With subclasses of Decorator (such as UserDecorator), the pre-decorators and post-decorators are invoked only if decoration is needed by the decorator being declared in <servlet-class> (in this example, UserDecorator).
For more information on the Navigator and Decorator classes, see the Javadoc documentation for these classes.
The following descriptions briefly explain the SESM utility servlets. For more information on a servlet, see the Javadoc for the servlet class. In each description, the Servlet Mapping entry is the URL-to-servlet mapping that is defined in the NWSP web.xml file. You can add a servlet mapping for any servlet or modify an existing mapping.
com.cisco.sesm.navigator.Alias Alias servlet's initialization parameters include the following:
| Initialization Parameter | Description |
|---|---|
Specifies the URI to which |
Alias is used with the servlet name StatusView: <servlet>
<servlet-name>StatusView</servlet-name>
<servlet-class>com.cisco.sesm.navigator.Alias</servlet-class>
<load-on-startup>1</load-on-startup>
<init-param>
<param-name>to</param-name>
<param-value>/user/nocache/vfile/pages/status.jsp</param-value>
</init-param>
</servlet>
StatusView is requested, the Alias servlet forwards the HTTP request to the servlet chain /user/nocache/vfile/pages/status.jsp. The to initialization parameter for the Alias servlet specifies the URI to which the request is forwarded. For information on servlet chains, see the "Servlet Chaining" section. None
Class: com.cisco.sesm.webapp.decorator.BuildVersionDecorator "buildVersion". The build version is obtained from the configuration files and identifies which version of this software is running. I18nObject). The possible values of the internationalized object include resources with keys versionNotAvailable and versionError. /cache/* com.cisco.sesm.navigator.CacheDecorator CacheDecorator servlet writes HTTP headers into the response indicating that the response is to be cached. CacheDecorator can determine that the HTTP response content is not required because it is already cached, the request is quickly terminated with an empty response. In this case, CacheDecorator does not forward to any other decorator or servlet. The HTTP client will use the response that it has already cached. NoCacheDecorator servlet. com.cisco.sesm.navigator.CookieDecorator "cookie" to the current HTTP session. The value of the attribute represents the HTTP session ID. "cookie" attribute to write the session ID into every URL that is returned to the client. CookieDecorator can determine that the HTTP client supports cookies, the "cookie" attribute is set to the empty string. The "cookie" attribute is never null once the web application invokes CookieDecorator. CookieDecorator does not know whether the HTTP client supports cookies in the HTTP headers. In this case, the "cookie" attribute is set to the session ID. CookieDecorator. (In the NWSP web.xml file, CookieDecorator is declared with the servlet name Cookie.) In the example, the JSP-page code does the following: decorate tag of the Navigator tag library to call the CookieDecorator.decorateIfNecessary method to decorate (if needed) the HTTP session with a "cookie" attribute."cookie" attribute as a JavaBean instance so that it accessed as a scripting variable.cookie variable into the URL as "/myAccount<%=cookie%>". <%@ taglib uri="http://www.cisco.com/taglibs/navigator" prefix="nav" %>
<nav:decorate name="Cookie" />
<jsp:useBean id="cookie" class="java.lang.String" scope="session" />
...
<th><a href="/myAccount<%=cookie%>">My-Account</a></th>
<%=cookie> into the URL just before the place where a question mark would be located at the beginning of the query-string. decorate tag, see the "decorate Tag" section. /pool/* com.cisco.sesm.navigator.DecoratorPool Decorator instance. When a JSP page is used as a decorator, it must register itself in the jspInit method by calling DecoratorPool.register(JspPage). For information on JSP-page decorators, see the "Creating or Customizing Dimension Decorators" section. /end/* com.cisco.sesm.navigator.EndSessionDecorator HttpSession.invalidate method.com.cisco.sesm.navigator.InsecureDecorator InsecureDecorator redirects the request to an insecure (HTTP) version of the same request. InsecureDecorator servlet is successful in redirecting the request, it sends the HTTP client an SC_MOVED_TEMPORARILY (302) status code in the response. In addition, InsecureDecorator terminates the current request by throwing a ResponseCompleteNotice, which is wrapped inside a ServletException. SecureDecorator servlet.com.cisco.sesm.navigator.HttpSniffDecorator HttpSniffBean attribute named "httpSniffBean" to the HTTP session. HttpSniffBean contains information about the HTTP client device. It obtains the information from the HTTP headers. Table B-1 provides information on the HttpSniffBean properties.
| Bean Property | Description |
|---|---|
| The bean sets
|
| The bean sets
|
| The bean sets
|
HttpSniffDecorator servlet is configured with a deployer-customizable post-decorator (httpSniff.jsp) that provides additional "browser sniffing" capabilities. Using this additional information about the client device, httpSniff.jsp modifies HttpSniffBean properties based on the characteristics that it detects. The intention is that the service-provider developer, who has knowledge of the client devices to expect, can modify httpSniff.jsp to provide better information on these devices. For example, the developer could modify httpSniff.jsp to use third-party browser-sniffing software. httpSniff.jsp uses a JavaScript probe to detect client-device characteristics and sets HttpSniffBean properties to the appropriate values. In addition, it sets the clientDeviceName property to wap if it detects a WAP phone simulator. /l10n/* com.cisco.sesm.navigator.L10nContextDecorator L10nContext) context. In the web.xml file, the initialization parameters for L10nContextDecorator define the default values for the current localization context. For information on the L0nContextDecorator servlet initialization parameters, see the "Setting a Default Localization Context" section. com.cisco.sesm.navigator.LocaleDecorator L10nContext) attribute"com.cisco.aggbu.l10n.context" locale dimension of the user shape attribute"shape" The LocaleDecorator servlet's initialization parameters include the following:
| Initialization Parameter | Description |
|---|---|
Specifies the language. | |
Specifies the country. | |
Specifies the variant (if any). |
France is: <servlet>
<servlet-name>France</servlet-name>
<servlet-class>com.cisco.sesm.navigator.LocaleDecorator</servlet-class>
<load-on-startup>1</load-on-startup>
<init-param>
<param-name>language</param-name>
<param-value>fr</param-value>
</init-param>
<init-param>
<param-name>country</param-name>
<param-value>FR</param-value>
</init-param>
...
</servlet>
LocaleDecorator is used with a servlet mapping, which indicates the locale value that will be tested. For example:<servlet-mapping>
<servlet-name>France</servlet-name>
<url-pattern>/locale=fr/*</url-pattern>
</servlet-mapping>
France, the following URL would invoke LocaleDecorator and set the language and country of the current localization context (L10nContext) to fr and FR, respectively. It also sets the locale dimension of the user shape to fr/FR. /cache/* com.cisco.sesm.navigator.NoCacheDecorator NoCacheDecorator servlet writes HTTP headers into the response indicating that the response is not to be cached.CacheDecorator servlet. com.cisco.sesm.navigator.OriginalURLDecorator "originalURL". The attribute value is the original URL that was sent from the HTTP client to the HTTP server. The original URL is the URL of the current HTTP request before any servlet forwarding takes place. "originalURL" attribute contains the complete URL of the request, including any parameters. The parameters are included as a query string regardless of whether the method is GET or POST. OriginalURLDecorator (whose servlet name in the web.xml file is OriginalURL). For example:<%-- Always capture original URL at start of each request. --%>
<nav:decorate name="OriginalURL" />
<jsp:useBean id="originalURL" type="java.lang.String" scope="request"/>
...
<jsp:param name = "okPage" value = "<%=originalURL%>" />
class com.cisco.sesm.webapp.decorator.PermissionDecorator permissionBean to the HTTP session. The bean is added as an HTTP session attribute named "permissionBean". The permissionBean contains Boolean variables indicating whether the current subscriber has permission to perform certain Cisco SESM web portal tasks, such as creating a subaccount. PermissionDecorator servlet is invoked on any JSP page where the page needs a permissionBean in order to determine the permissions that the subscriber has. For example, many JSP pages in NWSP need knowledge of subscriber permissions to determine what buttons (for example, the My Account and Accounts buttons) to display in the navigation bar. permissionBean properties.
| Bean Property | Description |
|---|---|
| The value |
| The value |
| The value |
| The value |
/redirect/*
Class: com.cisco.sesm.navigator.RedirectRemainder RedirectRemainder is mapped to the URL pattern /redirect/* in the NWSP web.xml file, the URL /redirect/next redirects to /next.RemoveAttributeDecorator Servlet
com.cisco.sesm.navigator.RemoveAttributeDecorator RemoveAttributeDecorator servlet's initialization parameters include the following:
| Initialization Parameter | Description |
|---|---|
Specifies the name of the attribute. | |
Specifies the scope of the attribute: request, session, or application. |
RefreshShape is requested, RemoveAttributeDecorator removes the "shape" attribute, which has session scope. <servlet>
<servlet-name>RefreshShape</servlet-name>
<servlet-class>
com.cisco.sesm.navigator.RemoveAttributeDecorator
</servlet-class>
<load-on-startup>1</load-on-startup>
<init-param>
<param-name>name</param-name>
<param-value>shape</param-value>
</init-param>
<init-param>
<param-name>scope</param-name>
<param-value>session</param-value>
</init-param>
<...
</servlet>
com.cisco.sesm.navigator.SecureDecorator SecureDecorator redirects the request to a secure (HTTPS) version of the same request. As an example, if the request were: SecureDecorator servlet redirects the request to: SecureDecorator servlet is successful in redirecting the request, the servlet sends the HTTP client an SC_MOVED_TEMPORARILY (302) status code in the response. In addition, SecureDecorator servlet terminates the current request by throwing a ResponseCompleteNotice, which is wrapped inside a ServletException. InsecureDecorator servlet. /shape/* com.cisco.sesm.navigator.ShapeDecorator Shape object for the user and ensures that there is a "shape" attribute with session scope that holds the Shape object. The Shape servlet's initialization parameters include the following:
| Initialization Parameter | Description |
|---|---|
Specifies a set of zero or more dimension IDs that the SESM software uses when it creates the dimensions for a user shape. |
Shape object encapsulates the set of characteristics that define the web resources available for a specific subscriber. A Shape object consists of one or more dimensions. Each dimension corresponds to a characteristic of the subscriber (for example, the browser software of the subscriber). The value of each dimension specifies one or more directories that the SESM software searches for requested resources for this subscriber. ShapeDecorator servlet, see the "Configuring User-Shape Dimensions" section. /snoop/* com.cisco.sesm.navigator.Snoop Snoop sends is "text/plain" so that you can view the information on different types of devices (for example, HTML browsers and WAP phones).Snoop is used for debugging an SESM web application and is not used in production applications./session/* com.cisco.sesm.webapp.decorator.SESMSessionDecorator "SESMSession" to the current HTTP request. The value of the attribute represents the active SESM session, which has been synchronized with the SSG. "SESMSession" attribute is successfully created and authenticated, initUser.jsp executes. The initUser.jsp page is a deployer-customizable decorator that you can modify to perform any subscriber-related initialization tasks that need to be accomplished after it is known that the user is authenticated. For example, initUser.jsp could be used to set the current localization (L10nContext) to the locale defined in the subscriber profile. TestDimensionDecorator Servlet
com.cisco.sesm.navigator.TestDimensionDecorator For testing purposes, sets a dimension of the user shape to a specified value. The TestDimensionDecorator servlet's initialization parameters include the following:
| Initialization Parameter | Description |
|---|---|
Specifies the dimension ID. | |
Specifies a value for the dimension identified by |
WAPDevice is: <servlet>
<servlet-name>WAPDevice</servlet-name>
<servlet-class>com.cisco.sesm.navigator.TestDimensionDecorator</servlet-class>
<load-on-startup>1</load-on-startup>
<init-param>
<param-name>id</param-name>
<param-value>device</param-value>
</init-param>
<init-param>
<param-name>value</param-name>
<param-value>wap</param-value>
</init-param>
...
</servlet>
TestDimensionDecorator is used with a servlet mapping, which indicates the dimension value that will be tested. For example:<servlet-mapping>
<servlet-name>WAPDevice</servlet-name>
<url-pattern>/device=wap/*</url-pattern>
</servlet-mapping>
WAPDevice, the following URL would invoke TestDimensionDecorator and set the device dimension to wap.com.cisco.sesm.navigator.TestUserDecorator For testing purposes, authenticates a user name and password. The user names and passwords that can be authenticated with TestUserDecorator are those defined in the demo.txt file, which is used for demonstration mode. The TestDimensionDecorator servlet's initialization parameters include the following:
| Initialization Parameter | Description |
|---|---|
Specifies a user name given in the demo.txt file. | |
Specifies the password for the user identified in |
golduser is: <servlet>
<servlet-name>golduser</servlet-name>
<servlet-class>com.cisco.sesm.webapp.decorator.TestUserDecorator</servlet-class>
<load-on-startup>0</load-on-startup>
<init-param>
<param-name>username</param-name>
<param-value>golduser</param-value>
</init-param>
<init-param>
<param-name>password</param-name>
<param-value>cisco</param-value>
</init-param>
...
</servlet>
TestUserDecorator is used with a servlet mapping, which indicates the user name and password value that will be tested. For example:<servlet-mapping>
<servlet-name>golduser</servlet-name>
<url-pattern>/user=golduser/*</url-pattern>
</servlet-mapping>
golduser, the following URL would invoke TestUserDecorator and try to authenticate the user name golduser with the password cisco./user/* com.cisco.sesm.webapp.decorator.UserDecorator UserDecorator adds the user name as an attribute to the HTTP session. This may require the user to authenticate. If the user is not known, the getNewUser method is called. ![]() |
Tip Many SESM JSP pages use UserDecorator as a pre-decorator to ensure that the subscriber cannot view a web page until authentication has occurred. |
UserDecorator, decoration is necessary until the user is known and the user is authenticated. SESM/SSG authentication can be lost without notification, leaving the web application with a user name but no SESM authentication. If you want to ensure that there is an authenticated user, invoke UserDecorator. For example, a JSP-page view might not care what the user name is, but by invoking UserDecorator, it ensures that the user is authenticated and that authentication takes place. /vfile/* com.cisco.sesm.navigator.VirtualFile Translates a virtual file name into an actual file name according to the current values for the dimensions of the user shape. The actual file name is a URI for a web resource. VirtualFile also attempts to find the resource located by the actual file name and, if it finds the resource, forwards the HTTP request to the resource. The VirtualFile servlet's initialization parameters include the following:
| Initialization Parameter | Description |
|---|---|
Specifies the path name for a virtual file. |
vfile initialization parameter to VirtualFile vfile initialization parameter to VirtualFile. Many of the NWSP views use this method to invoke VirtualFile. For example: <servlet>
<servlet-name>AccountLogonView</servlet-name>
<servlet-class>com.cisco.sesm.navigator.VirtualFile</servlet-class>
<load-on-startup>1</load-on-startup>
<init-param>
<param-name>vfile</param-name>
<param-value>/pages/accountLogon.jsp</param-value>
</init-param>
...
</servlet>
VirtualFile servlet can be invoked when the web application needs to find a resource that may differ according to the user shape. The virtual file name is the remainder of the URL in a servlet chain. In the following example, a URL for /pages/help.jsp contains a servlet chain that invokes VirtualFile (which is mapped to the URL /vfile/*). /user/nocache/vfile/pages/help.jsp
VirtualFile (vfile) must be located immediately before the virtual file name for the web resourcein the preceding example, immediately before /pages/help.jsp. For more information on the VirtualFile servlet, see "Mapping a Virtual File Name to an Actual File Name" section.
![]()
![]()
![]()
![]()
![]()
![]()
![]()
Posted: Thu Oct 24 07:55:03 PDT 2002
All contents are Copyright © 1992--2002 Cisco Systems, Inc. All rights reserved.
Important Notices and Privacy Statement.