Name

HttpServletRequest

Synopsis

HttpServletRequest extends javax.servlet.ServletRequest and provides a number of methods that make it easy to access specific information related to an HTTP request. This includes methods for directly accessing HTTP headers: getHeader(), getIntHeader(), getDateHeader(), and getHeaderNames(). Other methods return various information about the request, including getMethod(), which returns the request method (GET, POST, etc), getPathInfo(), which returns any extra path information attached to the request, getPathTranslated(), which translates the extra path information into a filesystem path, and getServletPath(), which returns the URI pointing to the current servlet, minus any extra path information. The interface also includes the getCookies() method for retrieving cookie data and getSession() for accessing the current HttpSession object.

                  Subclasses
public interface HttpServletRequest extends ServletRequest {
// Public Constants
   public static final String BASIC_AUTH;                        // ="BASIC”, 2.3
   public static final String CLIENT_CERT_AUTH;                  // ="CLIENT_CERT”, 2.3
   public static final String DIGEST_AUTH;                       // ="DIGEST”, 2.3
   public static final String FORM_AUTH;                         // ="FORM”, 2.3
                  // Property Accessor Methods (by property name)
   public abstract String getAuthType();  
   public abstract String getContextPath();                      // 2.2
   public abstract Cookie[] getCookies(); public abstract java.util.Enumeration ...

Get Java Enterprise in a Nutshell, Second 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.