Gokul Singh wrote:
> Hi,
>
> The class HttpUtils has been deprecated in servlet API 2.3.
> The specs say this about deprecation. " These methods were only useful with
> the default encoding and have been moved to the request interfaces."
> I use the method HttpUtils.parseQueryString(String q) at a few places.
> What is the replacement for this in the API (I could not find any relevant
> method in HttpServletRequest) or I have to write my own method to do this?
>
The reason that the parsing methods were deprecated in 2.3 is that they
do not
deal with the I18N requirement to be able to parse Strings in different
character sets. You can go grab the existing code from an open source
implementation of these classes (such as the "jakarta-servletapi" module
at
<http://jakarta.apache.org>), but you will quickly find yourself running
into
this limitation.
Although there are no parsing methods in the ServletRequest or
HttpServletRequest interfaces, there are many that let you access
request
parameters:
getParameter();
getParameterMap(); <-- New in 2.3
getParameterNames();
getParameterValues();
which all deal correctly with the character encoding issue, based on
either the
"Accept-Language" and "Content-Type" headers sent with the request, or
an
application call to request.setCharacterEncoding() if it wants to define
its
own.
You can also reconstruct the URL with
HttpServletRequest.getRequestURL();
>
> Regds,
> Gokul
>
Craig McClanahan
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html