Name
HttpUtils
Synopsis
Class Name: javax.servlet.http.HttpUtils
Superclass: java.lang.Object
Immediate Subclasses: None
Interfaces Implemented: None
Availability: Servlet API 1.0 and later
Description
A container object for a handful of potentially useful HTTP-oriented methods.
Class Summary
public class HttpUtils { // Constructors public HttpUtils(); // Class methods public static StringBuffer getRequestURL(HttpServletRequest req); public static Hashtable parsePostData(int len, ServletInputStream in); public static Hashtable parseQueryString(String s); }
Constructors
HttpUtils()
public HttpUtils()
- Description
The default constructor does nothing.
Class Methods
getRequestURL()
public static StringBuffer getRequestURL(HttpServletRequest req)
- Description
Reconstitutes the request URL based on information available in the
HttpServletRequest
object. Returns aStringBuffer
that includes the scheme, server name, server port, and extra path information, but not the query string. The reconstituted URL should look almost identical to the URL used by the client. This method can be used for error reporting, redirecting, and URL creation. For applications that need to uniquely identify particular servlets, thegetRequestURI( )
method ofHttpServletRequest
is generally a better choice.
parsePostData()
public static Hashtable parsePostData(int len, ServletInputStream in)
- Description
Parses
len
characters of parameter data from aServletInputStream
(usually sent as part of a POST operation). Throws anIllegalArgumentException ...
Get Java Servlet Programming, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.