This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes url with a space giving problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "url with a space giving problem" Watch "url with a space giving problem" New topic
Author

url with a space giving problem

Gopu Akraju
Ranch Hand

Joined: Jan 13, 2008
Posts: 242
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

Joined: May 03, 2008
Posts: 4523
    
    5

%20

edit Which you could have discovered by reading the API for java.net.URL. You would also have discovered an alternative approach.


luck, db
There are no new questions, but there may be new answers.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19656
    
  18

+ is also an option for spaces.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: url with a space giving problem
 
Similar Threads
Automatic Installation of 100+ Open Source Projects for Java Developers
Struts2-json plugin not serializing action class to json
REST vs SOAP - stateful/stateless
Getting message as Invalid JSON
Java EE 5 Tutorial - Problem with Web Services