File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Difference between encodeURL and encodeRedirectURL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Difference between encodeURL and encodeRedirectURL" Watch "Difference between encodeURL and encodeRedirectURL" New topic
Author

Difference between encodeURL and encodeRedirectURL

Malli Raman
Ranch Hand

Joined: Nov 07, 2001
Posts: 312
Hi All,
I want to know the difference between the encodeURL and encodeRedirectURL. I have found some related topics in the Java ranch, but i am not able to pinpoint the reason. Can anyone help me?
Thanks & Regards,
M.S.Raman
Arun Boraiah
Ranch Hand

Joined: Nov 28, 2001
Posts: 233
When redirecting to a page using sendRedirect use encodeRedirectURL, that is you are passing yoursession to the new request.
encodeURL can be used while include or forward to a page, where you need to pass the session info.
JSESSIONID gets appended in the url when cookies are disabled.


Sharing is learning
Malli Raman
Ranch Hand

Joined: Nov 07, 2001
Posts: 312
Originally posted by Arun Boraiah:
When redirecting to a page using sendRedirect use encodeRedirectURL, that is you are passing yoursession to the new request.
encodeURL can be used while include or forward to a page, where you need to pass the session info.
JSESSIONID gets appended in the url when cookies are disabled.

Thanks for your prompt reply. I need some clarification.
If we are redirecting the request to some other page, why we need to pass the session information to that page?
Regards,
M.S.Raman
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Difference between encodeURL and encodeRedirectURL