- Trending Categories
- Data Structure
- Operating System
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Which methods can be used to read HTTP header in your JSP program.
The request object provides methods to get HTTP header information including form data, cookies, HTTP methods, etc.
Following table lists out the important methods that can be used to read HTTP header in your JSP program. These methods are available with HttpServletRequest object which represents client request to webserver.
|Sr.No.||Method & Description|
Returns an array containing all of the Cookie objects the client sent with this request.
Returns an Enumeration containing the names of the attributes available to this request.
Returns an enumeration of all the header names this request contains.
Returns an enumeration of String objects containing the names of the parameters contained in this request.
Returns the current session associated with the this request, or if the request does not have a session, creates one.
|6||HttpSession getSession(boolean create)|
Returns the current HttpSession associated with the this request or, if if there is no current session and create is true, returns a new session.
Returns the preferred Locale that the client will accept content in, based on the Accept-Language header.
|8||Object getAttribute(String name)|
Returns the value of the named attribute as an Object, or null if no attribute of the given name exists.
Retrieves the body of the request as binary data using a ServletInputStream.
Returns the name of the authentication scheme used to protect the servlet, for example, "BASIC" or "SSL," or null if the JSP was not protected.
Returns the name of the character encoding used in the body of this request.
Returns the MIME type of the body of the request, or null if the type is not known.
Returns the portion of the request URI that indicates the context of the request.
|14||String getHeader(String name)|
Returns the value of the specified request header as a String.
Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.
|16||String getParameter(String name)|
Returns the value of a request parameter as a String, or null if the parameter does not exist.
Returns any extra path information associated with the URL the client sent when it made this request.
Returns the name and version of the protocol the request uses.
Returns the query string that is contained in the request URL after the path.
Returns the Internet Protocol (IP) address of the client that sent the request.
Returns the fully qualified name of the client that sent the request.
Returns the login of the user making this request, if the user has been authenticated, or null if the user has not been authenticated.
Returns the part of this request's URL from the protocol name up to the query string in the first line of the HTTP request.
Returns the session ID specified by the client.
Returns the part of this request's URL that calls the JSP.
|26||String getParameterValues(String name)|
Returns an array of String objects containing all of the values the given request parameter has, or null if the parameter does not exist.
Returns a boolean indicating whether this request was made using a secure channel, such as HTTPS.
Returns the length, in bytes, of the request body and made available by the input stream, or -1 if the length is not known.
|29||int getIntHeader(String name)|
Returns the value of the specified request header as an int.
Returns the port number on which this request was received.
- How to read a HTTP header using JSP?
- How can you read a request header information in JSP?
- Which library can be used to interact with database in JSP?
- Can somebody explain the HTTP headers in simpler terms in JSP context?
- Why can't Java generics be used for static methods?
- What are important HTTP headers to be frequently used in Python CGI Programming?
- Give methods by which pollution due to plastics can be solved.
- How to read cookies with JSP?
- What is the maximum size of HTTP header values?
- How can we restrict access to methods with specific HTTP verbs in C# ASP.NET WebAPI?
- How to read all HTTP headers in Python CGI script?
- How to read all form parameters in JSP?
- How to read form data using JSP?
- What methods of session object is used frequently in JSP and for what purpose?