• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

encodeURL vs encodeRedirectURL

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What's the difference between HttpServletResponse.encodeURL(String url) & HttpServletResponse.encodeRedirectURL(String url) ?
Both say
"The implementation of this method includes the logic to determine whether the session ID needs to be encoded in the URL".
what does "rules for making this determination" mean in teh following API doc for encodeRedirectURL ?
"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 seperate from the encodeURL method. "
Any ideas ?
-Srini
 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Srini:
The decision to be taken by the rules is whether the target page (to which the request is being redirected) participates in a session or not. If the target page doesn't participate in a session, then there is no point in rewritting the URL with session info. IMO, thisis the rule.
Whereas if you use encodeURL(...) method, it will rewrite the URL based on whether the client has enabled or disabled Cookies.
So in a way, the rules for encodeURL(...) method are determined by the client you are talking to. On the other hand, with the encodeRedirectURL(...) method, the rules are determined by both the server and the client.
Anyother views/explanations....
- satya
ps (response to another thread):
Sorry, I couldn't shut-up...
 
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Madhav Lakkapragada:
[QB]Srini:
The decision to be taken by the rules is whether the target page (to which the request is being redirected) participates in a session or not. If the target page doesn't participate in a session, then there is no point in rewritting the URL with session info. IMO, thisis the rule.

Hi friends,
As I am not clear about what madhav has mentioned here & difference between encodeURL and encodeRedirectURL, So I am posting this here.
In this Madav told that based on session participation we have to call to either encodeURL and encodeRedirectURL. In this he is not mentioned which method is to be called for a url which is not going to be paritcipate in the session and which method has to be called for participating in the session.

<----
Whereas if you use encodeURL(...) method, it will rewrite the URL based on whether the client has enabled or disabled Cookies.
So in a way, the rules for encodeURL(...) method are determined by the client you are talking to. On the other hand, with the encodeRedirectURL(...) method, the rules are determined by both the server and the client.
---->
I am not sure about the above points. Because I heard if cookies are disabled then URLRewriting will be enabled in most of the servers for session tracking by default (I think weblogic behaves like that). Can anyone please explain me detaily.
Thanks & Regards,
M.S.Raman

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Malli
I'm not sure if most servers will perform the function of using URL rewriting if cookies are disabled. I think the more important questions to ask is if J2EE 1.3 specification require server to perform URL rewriting when cookies are disabled. After all we are being tested on the J2EE spec and not the extra functions of most servers. Please correct me if I'm wrong
about this point.
Thank You
 
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure if most servers will perform the function of using URL rewriting if cookies are disabled
Some web application frameworks (struts) do the encoding for you.
the more important questions to ask is if J2EE 1.3 specification require server to perform URL rewriting when cookies are disabled.
nope.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic