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, request attributes, client locales, 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 Enumeration getAttributeNames(); // New in 2.1 public abstract String getCharacterEncoding(); // New in 2.0 public abstract int getContentLength(); public abstract String getContentType(); public abstract ServletInputStream getInputStream() throws IOException; public abstract Locale getLocale(); // New in 2.2 public abstract Enumeration getLocales(); // New in 2.2 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); // Deprecated public abstract String getRemoteAddr(); public abstract String getRemoteHost(); ...

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.