This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes encodeURL & encodeRedirectURL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "encodeURL & encodeRedirectURL" Watch "encodeURL & encodeRedirectURL" New topic
Author

encodeURL & encodeRedirectURL

Eunis Huang
Greenhorn

Joined: Feb 11, 2002
Posts: 5
Dear Ranches,
How can tell me what the difference is between encodeURL and encodeRedirectURL? Are they both used for URL Rewriting?
Many thanks
Eunis
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
I think there was a previous debate on this topic, forgot what it resolved to. But anyways, yes both these methods are used to encode URL's.
encodeRedirectURL is used specifically to encode for the sendRedirect(...) method.
The difference is in deciding whether to encode the sessionID into the URL or not.
- satya


Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
Tim Duncan
Ranch Hand

Joined: Aug 20, 2001
Posts: 150
Originally posted by Madhav Lakkapragada:
The difference is in deciding whether to encode the sessionID into the URL or not.

Both methods will add jsessionid to the URL where necessary, however (according to the API) the logic for working out whether it is necessary, is different for sendRedirect, hence two methods.
Any idea why the logic should be different? Tomcat's implementation appears to use the same logic for both cases.
[ March 22, 2002: Message edited by: Tim Duncan ]
Eunis Huang
Greenhorn

Joined: Feb 11, 2002
Posts: 5
Thanks a lot. I got it
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: encodeURL & encodeRedirectURL
 
Similar Threads
encodeURL() v/s encodeRedirectURL()
encodeRedirectURL Vs encodeURL
Hints for SCWCD
encodeURL vs encodeRedirectURL
encodeURL vs encodeRedirectURL