HttpServletRequest Class

HttpServletRequest class enables a servlet to obtain information about a client request.

MethodDescription
String getAuthType( )It returns the authentication scheme.
Cookie[ ] getCookies( )It returns an array of the cookies in this request.
long getDateHeader(String field)It returns the value of the date header field named field.
String getHeader(String field)It returns the value of the header field named field.
Enumeration getHeaderNames( )It returns an enumeration of the header names.
int getIntHeader(String field)It returns the int equivalent of the header field named field.
String getMethod( )It returns the HTTP method for this request.
String getPathInfo( )It returns any path information that is located after the servlet path and before a query string of the URL.
String getPathTranslated( )It returns any path information that is located after the servlet path and before a query string of the URL after translating it to a real path.
String getQueryString( )It returns any query string in the URL.
String getRemoteUser( )It returns the name of the user who issued this request.
String getRequestedSessionId( )It returns the ID of the session.
String getRequestURI( )It returns the URI.
StringBuffer getRequestURL( )It returns the URI.
String getServletPath( )It returns that part of the URL that identifies the servlet.
HttpSession getSession( )It returns the session for this request. If a session does not exist, one is created and then returned.
HttpSession getSession(boolean new)If new is true and no session exists, creates and returns a session for this request. Otherwise, returns the existing session for this request.
boolean isRequestedSessionIdFromCookie( )It returns true if a cookie contains the session ID. Otherwise, returns false.
boolean isRequestedSessionIdFromURL( )It returns true if the URL contains the session ID. Otherwise, returns false.
boolean isRequestedSessionIdValid( )It returns true if the requested session ID is valid in the current session context.