Servlet 4.0 feature functions
The product supports the Servlet 4.0 specification.
In addition to these key features and enhancements in Servlet 4.0, descriptions of the new
Servlet 4.0 functions and deprecations are provided in the Java™ Servlet 4.0 Specification.
- The
javax.servlet.GenericFilter
andjavax.servlet.http.HttpFilter
classes are added. For more information, see the Javadoc. - The
getHttpServletMapping
method is added to theHttpServletRequest
interface. For more information, see Section 12.3 of the Servlet 4.0 Specification. - The
default-context-path
element in the schema of the web.xml file is added. For more information, see the default-context-path element description in Section 14.4.30 in the Servlet 4.0 Specification. - The
request-character-encoding
andresponse-character-encoding
elements in the schema of the web.xml file are added. For more information, see Section 14.4.31 and Section 14.4.32 of the Servlet 4.0 Specification. - The
getRequestCharacterEncoding
,setRequestCharacterEncoding
,getResponseCharacterEncoding
, andsetResponseCharacterEncoding
methods in theServletContext
interface are added. For more information, see Section 4.4.5, 3.12, and 5.6 of the Servlet 4.0 Specification. - The
getSessionTimeout
andsetSessionTimeout
methods in theServletContext
interface are added. For more information, see the Javadoc and Section 4.4.4 and 7.5 of the Servlet 4.0 Specification. - Support for the
HTTP/2 push
andHTTP/2 promise
methods are added. Obtain ALPN support to use push support securely. ALPN support is not generally available with Java 8, and you need to obtain it. - Support for HTTP trailers is added. For more information, see Section 5.3, HTTP
Trailers, of the Servlet 4.0 specification. Add the
getTrailerFields
andisTrailerFieldsReady
methods in theHttpServletRequest
interface, and add thesetTrailerFields
andgetTrailerFields
methods in theHttpServletResponse
interface.