Use of JCP site is subject to the
JCP Terms of Use and the
Oracle Privacy Policy
|
Change LogThis document is the maintenance review of the Java Servlet 2.5 Servlet specification developed under the Java Community ProcessSM (JCP). Changes Since Servlet 2.41. Session ClarificationClarified SRV.7.3 "Session Scope" to allow for better support of session ids being used in more than one context. This was done to support the Portlet specification (JSR 168). Added the following paragraph at the end of SRV.7.3 "Session Scope": "Additionally, sessions of a context must be resumable by requests into that context regardless of whether their associated context was being accessed directly or as the target of a request dispatch at the time the sessions were created." Made the changes in SRV.8.3 "The Include Method" by replacing the following text: "It cannot set headers or call any method that affects the headers of the response. Any attempt to do so must be ignored." "It cannot set headers or call any method that affects the headers of the response, with the exception of the HttpServletRequest.getSession() and HttpServletRequest.getSession(boolean) methods. Any attempt to set the headers must be ignored, and any call to HttpServletRequest.getSession() or HttpServletRequest.getSession(boolean) that would require adding a Cookie response header must throw an IllegalStateException if the response has been committed." 2. Filter All DispatchesModified SRV.6.2.5 "Filters and the RequestDispatcher" to clarify a way to map a filter to all servlet dispatches by appending the following text to the end of the section: Finally, the following code uses the special servlet name '*': <filter-name>All Dispatch Filter</filter-name> <servlet-name>*</servlet-name> <dispatcher>FORWARD</dispatcher> This code would result in the All Dispatch Filter being invoked on request dispatcher forward() calls for all request dispatchers obtained by name or by path. 3. Multiple Occurrences of Servlet MappingsPrevious versions of the servlet schema allows only a single url-pattern or servlet name per servlet mapping. For servlets mapped to multiple URLs this results in needless repetition of whole mapping clauses. The deployment descriptor servlet-mappingType was updated to: <xsd:complexType name="servlet-mappingType"> <xsd:element name="servlet-name" type="j2ee:servlet-nameType"/> <xsd:element name="url-pattern" type="j2ee:url-patternType" minOccurs="1" 4. Multiple Occurrences Filter MappingsPrevious versions of the servlet schema allows only a single url-pattern in a filter mapping. For filters mapped to multiple URLs this results in needless repetition of whole mapping clauses. The deployment descriptor schema the filter-mappingType was updated to: <xsd:complexType name="filter-mappingType"> <xsd:element name="filter-name" type="j2ee:filter-nameType"/> <xsd:choice minOccurs="1" maxOccurs="unbounded"> <xsd:element name="url-pattern" type="j2ee:url-patternType"/> <xsd:element name="servlet-name" type="j2ee:servlet-nameType"/> <xsd:element name="dispatcher" type="j2ee:dispatcherType" minOccurs="0" <xsd:attribute name="id" type="xsd:ID"/> This change allows multiple patterns and servlet names to be defined in a single mapping as can be seen in the following example: <filter-name>Demo Filter</filter-name> <url-pattern>/foo/*</url-pattern> <url-pattern>/bar/*</url-pattern> <servlet-name>Logger</servlet-name> <dispatcher>REQUEST</dispatcher> <dispatcher>ERROR</dispatcher> SRV.6.2.4 "Configuration of Filters in a Web Application" was updated to clarify the cases where there are multiple mappings with the following text: "If a filter mapping contains both <servlet-name> and <url-pattern>, the container must expand the filter mapping into multiple filter mappings (one for each <servlet-name> and <url-pattern>), preserving the order of the <servlet-name> and <url-pattern> elements." An examples was also provided to clarify cases when there are multiple mappings. 5. Support Alternative HTTP Methods with Authorization ConstraintsThe previous Servlet 2.4 schema restricted HTTP methods to GET, POST, PUT, DELETE, HEAD, OPTIONS, and TRACE. The schema http-methodType was changed from: <xsd:complexType name="http-methodType"> <xsd:restriction base="j2ee:string"> <xsd:enumeration value="GET"/> <xsd:enumeration value="POST"/> <xsd:enumeration value="PUT"/> <xsd:enumeration value="DELETE"/> <xsd:enumeration value="HEAD"/> <xsd:enumeration value="OPTIONS"/> <xsd:enumeration value="TRACE"/> <xsd:simpleType name="http-methodType"> A HTTP method type as defined in HTTP 1.1 section 2.2. <xsd:restriction base="xsd:token"> <xsd:pattern value="[\p{L}-[\p{Cc}\p{Z}]]+"/> The http-method elements now need to be a token as described in HTTP 1.1 specification section 2.2. 6. Minimum J2SE RequirementServlet 2.5 Containers now require J2SE 5.0 as the minimum Java version. SRV.1.2 "What is a Servlet Container?" was updated to reflect this requirement. 7. annotations and Resource InjectionJava EE technology compliant containers require annotations and resource injection on servlets, filters, and listeners. SRV.14.5 "Annotations and Resource Injection" describes the annotations and resource injection in further detail. 8. SRV.9.9 ("Error Handling") Requirement RemovedSRV.9.9.1 "Request Attributes" defines the following requirement: If the location of the error handler is a servlet or a JSP page: The response setStatus method is disabled and ignored if called. The JSP 2.1 EG has asked that this requirement above be removed to allow JSP error pages to update the response status. 9. HttpServletRequest.isRequestedSessionIdValid() ClarificationThe API clarification better describes what happens when a client did not specify a session id. The API documentation in SRV.16.1.3 "HttpServletRequest" was updated to specify when false is returned. The API documentation now states: 10. SRV.5.5 ("Closure of Response Object") ClarificationThe behavior in SRV.5.5 "Closure of Response Object" the response's content length is set to 0 via response.setHeader("Content-Length", "0") and any subsequently setHeader() calls are ignored. SRV.5.5 "Closure of Response Object" was updated to allow all headers to be set by changing: "The amount of content specified in the setContentLength method of the response and has been written to the response" "The amount of content specified in the setContentLength method of the response has been greater than zero and has been written to the response" 11. ServletRequest.setCharacterEncoding() ClarifiedThe API in SRV.15.2.16 "ServletRequest" was updated to described the behavior if the method is called after the getReader() was called. If the getReader() is called there will be no effect. |