The HttpServletRequest Object:
The request object is an instance of a javax.servlet.http.HttpServletRequest object. Each time a client requests a page the JSP engine creates a new object to represent that request.
The request object provides methods to get HTTP header information including form data, cookies, HTTP methods etc.
There are following important methods which can be used to read HTTP header in your JSP program. These method are available with HttpServletRequest object which represents client request to webserver.
|
S.N. |
Method & Description |
|
1 |
Cookie[] getCookies() |
|
2 |
Enumeration getAttributeNames() |
|
3 |
Enumeration getHeaderNames() |
|
4 |
Enumeration getParameterNames() |
|
5 |
HttpSession getSession() |
|
6 |
HttpSession getSession(boolean create) |
|
7 |
Locale getLocale() |
|
8 |
Object getAttribute(String name) |
|
9 |
ServletInputStream getInputStream() |
|
10 |
String getAuthType() |
|
11 |
String getCharacterEncoding() |
|
12 |
String getContentType() |
|
13 |
String getContextPath() |
|
14 |
String getHeader(String name) |
|
15 |
String getMethod() |
|
16 |
String getParameter(String name) |
|
17 |
String getPathInfo() |
|
18 |
String getProtocol() |
|
19 |
String getQueryString() |
|
20 |
String getRemoteAddr() |
|
21 |
String getRemoteHost() |
|
22 |
String getRemoteUser() |
|
23 |
String getRequestURI() |
|
24 |
String getRequestedSessionId() |
|
25 |
String getServletPath() |
|
26 |
String[] getParameterValues(String name) |
|
27 |
boolean isSecure() |
|
28 |
int getContentLength() |
|
29 |
int getIntHeader(String name) |
|
30 |
int getServerPort() |