• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

encodeURL() doesn't actually encode URL's

 
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
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • 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.
 
Bartender
Posts: 4107
72
Hibernate Fedora Chrome
  • 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
 
Villains always have antidotes. They're funny that way. Here's an antidote disguised as a tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic