• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

When to use URLRewriting ?

 
James Tharakan
Ranch Hand
Posts: 580
Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As i understand Url Rewriting is used when the cookies are disabled by the client. But if the client accepts cookies then url Rewriting is useless(waste of time in writing the code related to urlrewriting stuff).

So does that mean that we use urlrewriting ONLY TO BE at safer side. ?
 
Ankit Garg
Sheriff
Posts: 9580
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Containers only do URL Rewriting if the client doesn't accept cookies. So for the first requests all the links will be rewritten (as the container doesn't know if client accepts cookies), and if the client accepts cookies, then URL Rewriting will be skipped from the second request...
 
James Tharakan
Ranch Hand
Posts: 580
Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ankit Garg wrote: then URL Rewriting will be skipped from the second request...

But still when writing the code, the URL rewriting should be done everywhere irrespective of whether the client accepts cookies or not . Isn't it ?
 
Łukasz Suchecki
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes
you should ALWAYS use <c:url>, <c:redirect>, response.encodeURL, response.encodeRedirectURL.
And the container should take care about determining if you have cookies enabled (and encoding is not needed), or you have cookies disabled and it needs to keep encoding urls
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic