O'Reilly logo

Java Servlet Programming by Jason Hunter

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

ServletRequest

Synopsis

Interface Name: javax.servlet.ServletRequest

Superinterface: None

Immediate Subinterfaces: javax.servlet.http.HttpServletRequest

Implemented By: None

Availability: Servlet API 1.0 and later

Description

A ServletRequest object encapsulates information about a single client request, including request parameters, implementation-specific attributes, and an input stream for reading binary data from the request body. ServletRequest can be subclassed to provide additional protocol-specific information. HttpServletRequest, for instance, includes methods to manipulate HTTP headers.

Interface Declaration

public interface ServletRequest {
  // Methods
  public abstract Object getAttribute(String name);
  public abstract String getCharacterEncoding();                // New in 2.0
  public abstract int getContentLength();
  public abstract String getContentType();
  public abstract ServletInputStream getInputStream() throws IOException;
  public abstract String getParameter(String name);
  public abstract Enumeration getParameterNames();
  public abstract String[] getParameterValues(String name);
  public abstract String getProtocol();
  public abstract BufferedReader getReader() throws IOException;// New in 2.0
  public abstract String getRealPath(String path);
  public abstract String getRemoteAddr();
  public abstract String getRemoteHost();
  public abstract String getScheme();
  public abstract String getServerName();
  public abstract int getServerPort();
}

Methods

getAttribute()

public abstract Object getAttribute(String ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required