• Post Reply Bookmark Topic Watch Topic
  • New Topic

getting http header

 
ajse ruku
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
I need to get "Via" which is a general http request header.But the method getHeaderNames() of HttpServletRequest does not contain this header.I want to know ,is there any other way to get "Via" header or it is because , there is some other way to get it .Please express your views on this.

regards.
ajse
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If getHeaderNames() does not return the header name, the header is not on the request. What makes you think that the header is actually there?

There are tools that you add to browsers such as Firefix that will show you the actual headers sent and received.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
LiveHTTPHeaders is one such tool, and it's incredibly useful for doing web development.
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by ajse roy:
Hi ,
I need to get "Via" which is a general http request header.But the method getHeaderNames() of HttpServletRequest does not contain this header.I want to know ,is there any other way to get "Via" header or it is because , there is some other way to get it .Please express your views on this.

regards.
ajse


Are you sure that the HTTP request contains that header.Try using some tool like tcpmon ,or the one Ulf has suggested to check whether your request actually contains the header.
 
ajse ruku
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,
Thanks for your response.Please refer to the section 14.45 of http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html to find info about "Via" if you have time.
This header is absent in my request.So is it because of not getting set in the way before reaching to the server or as there are two types of headers i.e general-header(such as Via,cache-control) and request-header(such as user-agent,accept etc) and there are different ways of getting them?
 
ajse ruku
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

Thanks for your response.Please refer to the section 14.45 of http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html to find info about "Via" if you have time.

This header is absent in my request.So is it because of not getting set in the way before reaching to the server or as there are two types of headers i.e general-header(such as Via,cache-control) and request-header(such as user-agent,accept etc) and there are different ways of getting them?

regards,
ajse
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Via" is only required for gateways and proxies, not generally. Are you using either one of those?
 
ajse ruku
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ulf,

you are correct.Gateways and proxies are there in the actual deployment environment of the softwar.But i am testing my code locally.Is it the reason why "Via" is absent?

regards,
ajse
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you just answered your own question.
If the header is created by gateways and you're running locally (no gateway) then you aren't going to get headers created by a gateway.
 
William Janssen
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because you probally do not have a gateway / proxy locally.
This http header is added by the proxy / gateway to the http request and is not set by the browser.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!