HttpServletRequest Interface  
public interface HttpServletRequest extends ServletRequest  
 
ServletRequest  
      HttpServletRequest

The HttpServletRequest interface extends the ServletRequest interface to provide methods that can be used to obtain information about a request to an HttpServlet.

getSession()  
public HttpSession getSession() public HttpSession getSession(boolean create) Method
 

getSession() returns the HttpSession object associated with the request. By default, if the request does not currently have a session calling this method will create one. Setting the boolean parameter create to false overrides this.

getDateHeader()  
public long getDateHeader(String headerName) Method
 

getDateHeader() returns a long value that converts the date specified in the named header to the number of milliseconds since January 1, 1970 GMT. This method is used with a header that contains a date and returns –1 if the request does not contain the specified header.

getHeader()  
public String getHeader(String headerName) Method
 

getHeader() returns the value of the specified header expressed as a String object or –1 if the request does not contain the specified header.

getHeaderNames()  
public Enumeration getHeaderNames() Method
 

getHeaderNames() returns an Enumeration containing all of the header names used by the request.

getHeaders()  
public Enumeration getHeaders(String headerName) Method
 

getHeaders() returns an Enumeration containing all of the values associated with the specified header name. The method returns null if the request does not contain the specified header.

getIntHeader()  
public int getIntHeader(String headerName) Method
 

getIntHeader() returns the value of the specified header as an int. This method returns –1 if the request does not contain the specified header and throws a NumberFormatException if the header value cannot be converted to an int.

getRequestedSessionId()  
public String getRequestedSessionId() Method
 

getRequestedSessionId() returns the session ID specified by the client machine or null if the request did not specify an ID.

isRequestedSessionIdFromCookie()  
public boolean isRequestedSessionIdFromCookie() Method
 

isRequestedSessionIdFromCookie() returns true if the session ID came in from a cookie.

isRequestedSessionIdFromURL()  
public boolean isRequestedSessionIdFromURL() Method
 

isRequestedSessionIdFromURL() returns true if the session ID came in as part of the request URL.

isRequestedSessionIdValid()  
public boolean isRequestedSessionIdValid() Method
 

isRequestedSessionIdValid() returns true if the requested session ID is still valid.

getContextPath()  
public String getContextPath() Method
 

getContextPath() returns the part of the request URL that indicates the context path of the request. The context path is the first part of the URL and always begins with the "/" character. For servlets running in the root context, this method returns an empty String.

getPathInfo()  
public String getPathInfo() Method
 

getPathInfo() returns any additional path information contained in the request URL. This extra information will be after the servlet path and before the query string. This method returns null if there is no additional path information.

getPathTranslated()  
public String getPathTranslated() Method
 

getPathTranslated() returns the same information as the getPathInfo() method but translates it into a real path.

getServletPath()  
public String getServletPath() Method
 

getServletPath() returns the part of the request URL that was used to call the servlet without any additional information or the query string.

getAuthType()  
public String getAuthType() Method
 

getAuthType() returns the name of the authentication scheme used in the request. Typical return values are "BASIC" or "SSL". The method returns null if no authentication scheme was used.

getCookies()  
public Cookie[] getCookies() Method
 

getCookies() returns array containing any Cookie objects sent with the request or null if no Cookie objects were sent.

getMethod()  
public String getMethod() Method
 

getMethod() returns the name of the HTTP method used to make the request. Typical return values are "GET", "POST", or "PUT".

getQueryString()  
public String getQueryString() Method
 

getQueryString() returns the query string that was contained in the request URL or null if there was no query string.

getRemoteUser()  
public String getRemoteUser() Method
 

getRemoteUser() returns the login of the user making the request or null if the user has not been authenticated.

getRequestURI()  
public String getRequestURI() Method
 

getRequestURI() returns a sub-section of the request URL from the protocol name to the query string.