• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

encodeURL() doesn't actually encode URL's

 
JohnWilliam Fitz
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.

It seems to me that encodeURL() has been named incorrectly, because it doesn't actually encode URL's at all (at least I cannot get it to). For a definition of URL encoding check here...

http://www.blooberry.com/indexdot/html/topics/urlencoding.htm

For example, if I put the following in a servlet...



...the dollar sign between the b and the c should be converted to %24 when it is output to the console, but it is not. It appears as a dollar sign.

So, it seems to me that all encodeURL() does is to *REWRITE* the URL (which is to add the session info to the end of the url if necessary).

Am I right about that? Or am I missing something?

John
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're misunderstanding the use of encodeURL. This method is used to append the session id to the url if necessary. (I don't know why they called it encodeURL...) To actually encode special characters, you can use java.net.URLEncoder instead.

it seems to me that all encodeURL() does is to *REWRITE* the URL (which is to add the session info to the end of the url if necessary).

That's right.
 
Vijitha Kumara
Bartender
Pie
Posts: 3930
21
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the naming convention sometimes confusing in some cases. Have seen it in HFSJ authors have said "They didn't ask us" when naming certain parts of the API
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic