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

Cookies with requestDispatcher

 
Sudarshan Muramreddy
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Is there any way i can send the hearder/cookies information ,when we do forward of request?

if i do sendredirect I can get all the cookies values, which ever i am setting but if i use forward they are lost.

I need to use forward BCOZ i have lots of hidden variables,which need to be passed.

Thanks,
Reddy
 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are u using dispatcher within the same application (or) different application.
 
Sudarshan Muramreddy
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Vishnu ,
I am using in the same application.

Thanks,
Sudarshan
 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try setting the cookie as session attribute.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you forward, you're passing the same request object to all resrources.
You shouldn't be losing anything.

What makes you think you are losing those values?
 
Stefan Evans
Bartender
Posts: 1640
9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the OP is trying to SET new cookies into the response object.
Of course as a result of forwarding, the response is reset, and none of the cookies are sent.

There is no way around this that I am aware of.
If you haven't done any output you could maybe "include" instead of "forward"
That will keep the cookies that have been set, and append the html output.
In theory anyway ;-)

Cheers,
evnafets
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64188
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of course as a result of forwarding, the response is reset, and none of the cookies are sent.


Umm, no. That is not correct. Forwarding does not reset the response. Any headers set prior to a forward operation remain on the response.
[ November 14, 2005: Message edited by: Bear Bibeault ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic