This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Sockets and Internet Protocols and the fly likes Server returned HTTP response code: 505 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Server returned HTTP response code: 505" Watch "Server returned HTTP response code: 505" New topic
Author

Server returned HTTP response code: 505

Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636



I am getting following exception

java.io.IOException: Server returned HTTP response code: 505 for URL:http://localhost:8080/myapp/layout/imageHandler.jsp?logo=36161/31234/photos/1271065897805.jpg

How to resolve this issue?

My blood is tested +ve for Java.
Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

try encoding the URL
URLs use some characters for special use in defining their syntax. When these characters are not used in their special role inside a URL, they need to be encoded.


one of these is the forward slash. So,


http://localhost:8080/myapp/layout/imageHandler.jsp?logo=36161/31234/photos/1271065897805.jpg

should be encoded as
http://localhost:8080/myapp/layout/imageHandler.jsp?logo=36161%2F31234%2Fphotos%2F1271065897805.jpg
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19679
    
  18

For which you can use URLEncoder:


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
 
subject: Server returned HTTP response code: 505