This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Servlets and the fly likes I have doubt, response.sendRedtrect Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "I have doubt, response.sendRedtrect" Watch "I have doubt, response.sendRedtrect" New topic
Author

I have doubt, response.sendRedtrect

ramesh gosala
Greenhorn

Joined: Sep 30, 2006
Posts: 7
Hi,
I have doubt regading...response.sendRedtrect,

That is, it possible to send Session object, one server to another server..using response.sendRedirect.

i would very thankful to give this answer,

Thank you

Ramesh
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

It is not.

The sendRedirect method merely sends a 302 response code to the browser along with a 'Location' response header.

This causes the browser to make a brand new request to the specified URL.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

Thanks ben,

or what about the two method of HttpServletResponse Interface encodeURL and encodeRedirectURL, They are used to append the session ID to the URL.

encodeRedirectURL Java Doc

can you please enlighten on these method.
Is it possible to pass your session to another server with the help of these methods? if not then... Any suggestion


Saifuddin..
[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Those methods only embed the session ID within the URL.

Your HTTPSession is an object that resides within your webapplication.
It can't be passed to other servers.
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

Thanks Ben,

to make me clear.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: I have doubt, response.sendRedtrect