Find JSRs
Submit this Search


Ad Banner
 
 
 
 

Change Log

 

Change Log

This document is the maintenance review of the Java Servlet 2.5 Servlet specification developed under the Java Community Process (JCP).

Changes Since Servlet 2.5 MR 2

Updated Java Enterprise Edition Requirements

Updated the Annotations to the final Java EE annotation names. Included EJBs, PersistenceContext, PersistenceContexts, PersistenceUnit, PersistenceUnits, and WebServiceRefs annotation descriptions. Also updated the "full" attribute in the web.xml to be "metadata-complete".

Clarified HttpServletRequest.getRequestURL()

The javadocs of javax.servlet.http.HttpServletRequest.getRequestURL()

have been misleading and causing confusion among developers.

 

The text in italics was added:

 

If this request has been forwarded using RequestDispatcher.forward(ServletRequest, ServletResponse) , the server path in the reconstructed URL must reflect the path used to obtain the RequestDispatcher, and not the server path specified by the client. Because this method returns a StringBuffer , not a string, you can modify the URL easily, for example, to append query parameters.

 

Removal of IllegalStateException from HttpSession.getId()

The HttpSessionBindingListener calls the valueUnbound event after the

session has been expired, unfortunately, the HttpSession.getId() method is often used in this scenario and is supposed to throw an IllegalStateException. The servlet EG agreed to remove the exception from the API to prevent these types of exceptions.

ServletContext.getContextPath()

The method getContextPath() was added to the ServletContext. The description is as follows:

public java.lang.String getContextPath()

Returns the context path of the web application. The context path is the portion of the request URI that is used to select the context of the request. The context path always comes first in a request URI. The path starts with a "/" character but does not end with a "/" character. For servlets in the default (root) context, this method returns "".

It is possible that a servlet container may match a context by more than one context path. In such cases getContextPath() will return the actual context path used by the request and it may differ from the path returned by this method. The context path returned by this method should be considered as the prime or preferred context path of the application.

Returns:

The context path of the web application.

 

HttpServletRequest.getContextPath() was updated to clarify its relationship with the ServletContext.getContextPath() method. The clarification is as follows.

 

It is possible that a servlet container may match a context by more than one context path. In such cases this method will return the actual context path used by the request and it may differ from the path returned by the ServletContext.getContextPath() method. The context path returned by ServletContext.getContextPath() should be considered as the prime or preferred context path of the application.

 

Requirement for web.xml in Java EE web Applications

Inclusion of a web.xml Deployment Descriptor was added which removes requirement for web applications. The section is as follows:

 

A web application is NOT required to contain a web.xml if it does NOT contain any Servlet, Filter, or Listener components. In other words an application containing only static files or JSP pages does not require a web.xml to be present.