Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading int headers from a Servlet  RSS feed

 
Reema Patel
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,
I'm trying to read an int header from the request in doGet() method.


But, on the browser I'm getting -1 for both the headers. Why is that so?
Any help shall be highly appreciated.

Thanks,
Reema
 
Muhammad Saifuddin
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to JavaDoc.

public int getIntHeader(java.lang.String name)

The default behavior of this method is to return getIntHeader(String name) on the wrapped request object.

Specified by:
getIntHeader in interface HttpServletRequest

Following copied from interface: javax.servlet.http.HttpServletRequest

Parameters:
name - a String specifying the name of a request header
Returns:
an integer expressing the value of the request header or -1 if the request doesn't have a header of this name
Throws:
java.lang.NumberFormatException - If the header value can't be converted to an int


hope it makes you clear..
[ February 24, 2007: Message edited by: Saif uddin ]
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Reema Patel:
Hello All,
I'm trying to read an int header from the request in doGet() method.


But, on the browser I'm getting -1 for both the headers. Why is that so?
Any help shall be highly appreciated.

Thanks,
Reema


You can use any tool that shows you the raw HTTP request.That will help you to see what exatcly the browser is sending..
you can use tcpmon , this somes with axis and there are many more in the web.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!