This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

encodeURL() doesn't actually encode URL's  RSS feed

 
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
Saloon Keeper
Posts: 3998
42
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
Boost this thread!