• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

encodeRedirectURL Vs encodeURL

 
Sagar kanchi
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

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


It seems both the methods (in HttpServletResponse)will do the same job.
Do you ppl find any differences? If so, could you please share with me?


Sagar
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
encodeRedirectURL is meant to be used with HttpServletResponse#sendRedirect, instead of encodeURL.
 
Sagar kanchi
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But still I can use encodeURL method to encode any url path and then use the encoded url string inside the response#sendRedirect() method. I wondered if it wouldn't give the same result.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may have surprises to use it with sendRedirect. As the API says, all URLs sent to the HttpServletResponse.sendRedirect method should be run through this method
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic