uCosminexus Application Server, Web Container Functionality Guide
This subsection describes the precautions for using the specifications that has been added and changed in Servlet 2.4 on the Application Server. For details on the Servlet 2.4 specifications and Servlet 2.3 specifications, see the respective specifications (Servlet 2.4 specifications and Servlet 2.3 specifications).
The X-Powered-By header added in the Servlet 2.4 specifications is not added to the response.
If you execute the forward method of the javax.servlet.RequestDispatcher class acquired with the getRequestDispatcher method of the javax.servlet.ServletRequest interface and javax.servlet.ServletContext interface, the following key attributes are added to the request object. However, the key attributes are not added in the forward method of the RequestDispatcher object acquired with the getNamedDispatcher method of the javax.servlet.ServletContext interface.
These attributes are added by the Web container. The event of adding an attribute is not reported to javax.servlet.ServletRequestAttributeListener. For details on the values of the added attributes, see the Servlet 2.4 specifications.
The javax.servlet.SingleThreadModel interface is no longer recommended from the Servlet 2.4 specifications.
With the Application Server, you can use the javax.servlet.SingleThreadModel interface regardless of the Web application version. However, see the Servlet 2.4 specifications, note the reason for which this interface is deprecated, and then use the interface.
The character encoding is set in the Content-Type header of the HTTP response by the setLocale method of the javax.servlet.ServletResponse interface. In the Servlet 2.4 specifications, the conditions for enabling the set character encoding have been changed.
The conditions enabled in the Application Server is described separately for Servlet 2.4 and later versions and Servlet 2.3.
The javax.servlet.UnavailableException exception indicates that usage is permanently unavailable. The specifications of the HTTP response code when the servlets and JSPs that threw the javax.servlet.UnavailableException exception are accessed have been post scripted in the Servlet 2.4 specifications.
The HTTP response codes when the servlets and JSPs that threw the exception are accessed in the Application Server are described separately for Servlet 2.4 and later versions and Servlet 2.3.
The timing for invoking the sessionDestroyed method of the javax.servlet.http.HttpSessionListener interface has been changed in the Servlet 2.4 specifications.
The timing when this method is invoked on the Application Server is described separately for Servlet 2.4 and later versions and Servlet 2.3.
Note that when session timeout is disabled, the listener related to the session is reported in the following order. The order for each Web application version is as follows:
The conditions for using the sendRedirect method of the javax.servlet.http.HttpServletResponse interface have been changed in the Servlet 2.4 specifications.
To execute this method on the Application Server normally, all the following conditions must be fulfilled:
The controlling of errors if these conditions are not fulfilled is described separately for Servlet 2.4 and later versions and Servlet 2.3.
In the Servlet 2.4 specifications, SC_FOUND is added in the javax.servlet.http.HttpServletResponse interface as the constant indicating HTTP status code 302. Furthermore, for downward compatibility, SC_MOVED_TEMPORARILY defined in the Servlet 2.3 specifications can be used as it is.
On the Application Server, SC_FOUND and SC_MOVED_TEMPORARILY can be used regardless of any Web application version.
Note that the status message Found is used in the Web container in the following cases:
In the Servlet 2.4 specifications, specifications are post scripted for the timeout in the javax.servlet.http.HttpSession interface during the execution of the service method.
On Application Server, regardless of the Web application version, the HttpSession does not timeout when the requests are being processed in the Web application.
Also, by controlling the number of concurrently executing threads in the Web applications or URL groups, the HttpSession does not timeout even when the request is pending. However, note that in the case of a pending request due to the controlling of the number of concurrently executing threads in the Web container, the HttpSession times out.
The description about the occurrence of an exception in the listener is added in the Servlet 2.4 specifications.
The control when an exception occurs in the listener if the Application Server is used is described separately for Servlet 2.4 and later versions and Servlet 2.3.
The description about the handling of the MANIFEST file described when using the external library in the Web application has been changed in the Servlet 2.4 specifications.
On the Application Server, the existence of the MANIFEST file and the contents of the MANIFEST file are not checked regardless of the Web application version.
The following table lists the operations after the requests using the cross context are forwarded and included between the Web applications with different servlet versions:
Table 6-21 Operations after forwarding and after including
Item No. | Addition functionality of Servlet 2.4 specifications/ Functionality with differences in the Web application version | Operations at the request forward destination/ include destination | |
---|---|---|---|
forward/ include from 2.4 to 2.3#1 | forward/ include from 2.3 to 2.4#2 | ||
1 | Application of filters during forward and during include | When you want to further implement forward or include from the servlets or JSPs after forward/ include is implemented, the Servlet 2.4 specifications are applied and you can use the filter. | When you want to further implement forward or include from the servlets or JSPs after forward/ include is implemented, the Servlet 2.3 specifications are applied and you cannot use the filter. |
2 | Invocation of javax.servlet.ServletRequestAttributeListener | The Servlet 2.4 specifications are applied and you can use the listener when you add attributes to the request. | The Servlet 2.3 specifications are applied and you cannot use the listener when you add attributes to the request. |
3 | JSP compilation | JSP compilation is executed as an application corresponding to Servlet 2.3. | JSP compilation is executed as an application corresponding to Servlet 2.4. |
4 | setLocale method of the javax.servlet.ServletResponse interface | The Servlet 2.4 specifications are applied and when all the following conditions are fulfilled, the settings for character encoding are enabled:
|
The Servlet 2.3 specifications are applied and the settings for character encoding are applied if specified before the response is committed. |
5 | Dispatch to servlets and JSPs that throw the javax.servlet.UnavailableException indicating that the usage is permanently unavailable | The Servlet 2.3 specifications are applied and a response with status 503 is returned. | The Servlet 2.4 specifications are applied and a response with status 404 is returned. |
6 | sessionDestroyed method of the javax.servlet.http.HttpSessionListener interface | The Servlet 2.4 specifications are applied and the method is executed before the HTTP session is destroyed. | The Servlet 2.3 specifications are applied and the method is executed after the HTTP session is destroyed. |
7 | Specification of an invalid URL in the sendRedirect method of the javax.servlet.http.HttpServletResponse interface | The Servlet 2.4 specifications are applied and the java.lang.IllegalStateException exception is thrown. | The Servlet 2.3 specifications are applied and status 404 is set in the response. |
8 | Listener definition to be used | In the case of the following listeners, the listener defined in the application at the forward or include destination will operate:
|
In the case of the following listeners, the listener defined in the application at the forward or include destination will operate:
|
9 | Operations when an exception occurs in the listener in the application at the forward or include destination when multiple listeners are defined in web.xml for processing the relevant events | In the case of the following listeners, the Servlet 2.4 specifications are applied and the listeners after the one in which an exception was thrown are not executed:
|
In the case of the following listeners, the Servlet 2.4 specifications are applied and the listeners after the one in which an exception was thrown are not executed:
|
10 | Status code of response that displays the error page specified in web.xml | The Servlet 2.4 specifications are applied and the response of the status code used when an error occurs is returned. | The Servlet 2.3 specifications are applied and a response with status 200 is returned. |
When you call an EJB 3.0 Session Bean from a Servlet 2.4 Web application, do not specify the ejb-ref tag or ejb-local-ref. tag in web.xml. Instead, specify the @EJB annotation or @EJBs annotation in the servlet class.
The J2EE server executes DI of Enterprise Bean for the servlet.
All Rights Reserved. Copyright (C) 2013, Hitachi, Ltd.