uCosminexus Application Server, Web Container Functionality Guide
This subsection describes the precautions related to session management.
You can change the name of HTTP Cookie and the path parameter name of a URL by performing the following settings:
When the webserver.session.cookie_config.name parameter of the Easy Setup definition file is true, and the specified HTTP Cookie name is duplicated with the path parameter name of the URL as well as the name of the Cookie specified in the Cookie addition function, the system performs the following operations.
URL rewrite is executed when the Servlet API that executes URL rewrite in the J2EE applications is invoked.
For details on these methods, see the Servlet specifications. Note that the encodeUrl(java.lang.String url) method and the encodeRedirectUrl(java.lang.String url) method are the deprecated APIs in Servlet 2.1 and later versions. Therefore, Hitachi recommends that you use methods other than these two methods.
As the API operations not specified in the Servlet specifications, this subsection describes the operations on Application Server for the return value of the Servlet API for executing URL rewrite.
An HTTP session is enabled only in Web applications that are processing the requests. Therefore, URL rewrite will only be performed if the URL specified in the Servlet API argument is the URL indicated in the Web applications that are processing the requests. The following table lists the conditions for determining whether the URL is in the Web applications that are processing the requests for each URL argument:
Table 2-31 Conditions for determining whether the URL is in the Web applications that are processing the requests for each URL argument
Types of argument URL | Conditions |
---|---|
Relative URL (Example: /ex/a.html) |
The URL is determined as being in the Web application only if the following condition is fulfilled:
|
Absolute URL (Example: http: //host1/ex/) |
The URL is determined as being in the Web application only if the following conditions are fulfilled:
|
This subsection also describes the return values when a string other than URL is specified in the Servlet API argument for executing URL rewrite. Furthermore, the specification of a query or fragment at the beginning of the URL is also described here.
The following table lists the return values for each Servlet API argument for executing URL rewrite:
Table 2-32 Return values for each Servlet API argument for executing URL rewrite
Item No. | Conditions | Return value or exceptions | |
---|---|---|---|
HTTP session | Argument | ||
1 | N | null | null is returned. |
2 | N | Invalid format for URL | The java.lang.IllegalArgumentException exception has occurred. |
3 |
|
Null character string | The value with the session ID added is returned for the URL path of the HTTP request and the query.#1 |
4 | URL beginning with query (when the first character is a question mark (?)) | The value with the value specified in the session ID and argument added is returned for the URL path of the HTTP request.#1 | |
5 | URL beginning with fragment (when the first character is a hash mark (#)) | The value specified in the argument is returned.#2 | |
6 | URL containing the path parameter that indicates the session ID of the current HTTP session | The value specified in the argument is returned. | |
7 | URL determined to be in the Web application that is processing the requests. | The value with the session ID added in the argument is returned. | |
8 | Other conditions | The value specified in the argument is returned. |
The following is an example of URL where URL rewrite is used to add the session ID. Note that this example is based on the following prerequisites:
The following is an example table describing the compliance between the specified value of the servlet API arguments used in URL rewrite and the return value after rewrite (URL):
Table 2-33 Specified value of the servlet API arguments used in URL rewrite and the corresponding return value after rewrite (URL)
Servlet API arguments | Return values |
---|---|
b.html | b.html;jsessionid=AAAAA111112222233333444445555566svr0 |
../b.html | ../b.html;jsessionid=AAAAA111112222233333444445555566svr0 |
../../b.html | ../../b.html |
http: //host2/ | http: //host2 |
https: //host1/gyoumu1/ | https: //host1/gyoumu1/;jsessionid=AAAAA111112222233333444445555566svr0 |
"" (null character string) | "/gyoumu1/app1/index.jsp;jsessionid=AAAAA111112222233333444445555566svr0?type=1" |
"?mode=2" | "/gyoumu1/app1/index.jsp;jsessionid=AAAAA111112222233333444445555566svr0?mode=2" |
"#aaa" | "#aaa" |
This point describes the precautions for using URL rewrite.
In the case of screen transition from the static contents (such as HTML file), the session managed with URL rewrite is not maintained.
When you use URL rewrite to manage a session, implement settings so that the screen will always transit by using servlets or JSPs. Also, implement the process for adding the session ID by rewriting URL with Servlet API in the servlets or JSPs.
Even if the HTTP request URL contains the path parameter indicating the session ID managed by URL rewrite, the path parameter indicating the session ID is not included in the URL acquired with the following methods:
When an HTTP request is send using the HTTPS protocol, the session ID generated by the Web container is returned to the client by the HTTP Cookie. At that time, the Secure property is allocated to the HTTP Cookie.
Also, when the scheme is set up using the gateway specification functionality so that the scheme is considered as HTTPS, and if the session ID generated by the Web container is returned to the client by the HTTP Cookie, the Secure attribute is allocated to the respective HTTP Cookie.
All Rights Reserved. Copyright (C) 2013, Hitachi, Ltd.