• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

setHeader() doubt

 
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what will be the value of head?

response.addHeader("head", "foo");
response.addHeader("head", "baz");
response.setHeader("head", "bar");

when we call request.getHeader("head");

Srividhya
[ August 11, 2008: Message edited by: Srividhya Kiran ]
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I don't think that setting a header in the response affects headers in the request, so request.getHeader("head") could return null or a String object, can't be determined from the information given.

Cheers,

Paul
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, Paul that's true,
What's the propose of adding our own custom headers to response, if we cannot get them back?
 
Ranch Hand
Posts: 295
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Originally posted by Chatu Dil:
Yes, Paul that's true,
What's the propose of adding our own custom headers to response, if we cannot get them back?



Why can't we get headers back.
We have HttpServletRequest.getHeaders(String name) method, with wich we can get the Enumeration of values for single header.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Chintu sirivennela:
We have HttpServletRequest.getHeaders(String name) method, with wich we can get the Enumeration of values for single header.

That will return request headers not response headers.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Chatu Dil:
What's the propose of adding our own custom headers to response, if we cannot get them back?

Response headers are intended for the client. So if your client is the browser, there's not much use to them. But if the client is an Ajax request, or some custom client, the custom headers can be read and processed by that client. Remember, there's more to HTTP than just the browsers.
 
Amruth Puppala
Ranch Hand
Posts: 295
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bear Bibeault ,

I'm extreamly sorry for my overlook.

Now I got the context.
 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ans: bar
 
Chatura Dilan
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks Bear, no it returns null, because there is no header called 'head' in the request and they are response headers.
 
Does this tiny ad smell okay to you?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic