InfoCenter Home >
4: Developing applications >
4.2: Building Web applications >
4.2.1: Developing servlets >
4.2.1.2: Servlet support and environment in WebSphere >
4.2.1.2.1a: Features of Java Servlet API 2.2

4.2.1.2.1a: Features of Java Servlet API 2.2

WebSphere Application Server supports Java Servlet API 2.2 and JSP 1.1.

Java Servlet API 2.2 contains many enhancements intended to make servlets part of a complete application framework

The Servlet 2.2 specification is available at java.sun.com/products/servlet/index.html

No new classes were added to the Java Servlet API 2.2. specification. The following table provides more information on 27 new methods, 2 new constants and 6 deprecated methods supported by WebSphere Application Server:

New methods Description
getServletName() Returns the servlet's registered name
getNamedDispatcher(java.lang.String name) Returns a dispatcher located by resource name
getInitParameter(java.lang.String name) Returns the value for the named context parameter
getInitParameterNames() Returns an enumeration of all the context parameter names
removeAttribute(java.lang.String name) Added for completeness
getLocale() Gets the client's most preferred locale
getLocales() Gets a list of the client's preferred locales as an enumeration of locale objects
isSecure() Returns true if the request was made using a secure channel
getRequestDispatcher(java.lang.String name) Gets a RequestDispatcher using what can be a relative path
setBufferSize(int size) Sets the minimum response buffer size
getBufferSize() Gets the current response buffer size
reset() Empties the response buffer, clears the response headers
isCommitted() Returns true if part of the response has already been sent
flushBuffer() Flushes and commits the response
setLocale(Locale locale) Sets the response locale, including headers and charset
getLocale() Gets the current response locale
UnavailableException(String message) Replaces UnavailableException(Servlet servlet, String message)
UnavailableException(String message, int sec) Replaces UnavailableException( int sec, Servlet servlet, String message)
getHeader(String message) Returns all the values for a given header, as an enumeration of strings
getContextPath() Returns the context path of this request
addHeader(String name, String value) Adds to the response another value for this header name
addDateHeader(String name, long date) Adds to the response another value for this header name
addIntHeader(String name, int value) Adds to the response another value for this header name
getAttribute(String name) ObjectHttpSession.getValue(String name)
getAttributeNames() Replaces String[] HttpSession. getValueNames()
setAttribute(String name, Object value) Replaces void HttpSession.setValue( String name, Object value)
removeAttribute(String name) Replaces void HttpSession.removeValue( String name)
New constants Description
SC_REQUESTED_RANGE_NOT_SATISFIABLE New mnemonic for status code 416
SC_EXPECTATION_FAILED New mnemonic for status code 417
Newly deprecated methods Description
UnavailableException(Servlet servlet, String message) Replaced by UnavailableException( String message)
UnavailableException(int sec, Servlet servlet, String message) Replaced by UnavailableException( string message, int sec)
getValue(String name) Replaced by Object HttpSession.getAttribute(String name)
getValueNames() Replaced by numeration HttpSession.getAttributeNames()
putValue(String message, Object value) Replaced by void HttpSession.setAttribute(String name, Object value)
removeValue(String message) Replaced by void HttpSession removeAttribute(String name)

Go to previous article: Servlet support and environment in WebSphere Go to next article: IBM extensions to the Servlet API

 

 
Go to previous article: Servlet support and environment in WebSphere Go to next article: IBM extensions to the Servlet API