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 Servlets and the fly likes Difference b/w response.encodeURL() and response.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 » Java » Servlets
Bookmark "Difference b/w response.encodeURL() and response.encodeRedirectURL()" Watch "Difference b/w response.encodeURL() and response.encodeRedirectURL()" New topic

Difference b/w response.encodeURL() and response.encodeRedirectURL()

Ceenu Reddy

Joined: Nov 16, 2006
Posts: 9

We use response.encodeURL() and response.encodeRedirectURL() methods are used for URL rewriting, if the cookies disabled in the browswer or not supported.

Can anybody explain what is the difference b/w above two methods exactly?

Thanks in advance...
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

The API can.


public java.lang.String encodeRedirectURL(java.lang.String url)

Encodes the specified URL for use in the sendRedirect method or, if encoding is not needed, returns the URL unchanged. The implementation of this method includes the logic to determine whether the session ID needs to be encoded in the URL. Because the rules for making this determination can differ from those used to decide whether to encode a normal link, this method is separated from the encodeURL method.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
It is sorta covered in the JavaRanch Style Guide.
subject: Difference b/w response.encodeURL() and response.encodeRedirectURL()
Similar Threads
A single session, multiple ports ?????
Questions related to final HFSJ mock exam
Difference b/w sendRedirect and forward
Confirmation required
RequestDispatcher URLrewrite SessionID