Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

url with a space giving problem

 
Gopu Akraju
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am constructing an url like below and trying to get the JSON objects.

I get the following error.

Error retrieving library list java.lang.IllegalArgumentException: Invalid uri 'http://test.ntu.edu.sh/libs/sample name/list/json': escaped absolute path not valid

If I paste the above URI on an browser, it goes through and I get the JSON object.
How to introduce a white space between "sample" + " " + "name" as the above construction doesn't pass.
Many Thanks in advance.
 
Darryl Burke
Bartender
Posts: 5125
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
%20

edit Which you could have discovered by reading the API for java.net.URL. You would also have discovered an alternative approach.
 
Rob Spoor
Sheriff
Pie
Posts: 20492
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
+ is also an option for spaces.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic