dcsimg
"File not found " error instead of "404 not found"
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   sabu_vs
Posted On:   Sunday, November 25, 2001 08:26 PM

Hi Could you pls tell me how to track the http error 404 not found using HttpUrlConnection When I connect to the server with an invalid URL("http://localhost:8080/Metasearch.htm2") my program only displays an IOError -java.io.FileNotFoundException: http://localhost:8080/Metasearch.htm2 this is the code I used to track the response codes httpCon-HttpURLConnection try{ if(httpCon.getResponseCode() != HttpURLConnection.HTTP_OK) { errorString="Http error: " + httpCon.getResponseMessage(); } }catch ( MalformedURLException e) { System.ou   More>>

Hi



Could you pls tell me how to track the http error 404 not found using HttpUrlConnection


When I connect to the server with an invalid URL("http://localhost:8080/Metasearch.htm2")

my program only displays an IOError -java.io.FileNotFoundException: http://localhost:8080/Metasearch.htm2




this is the code I used to track the response codes


httpCon-HttpURLConnection




try{



if(httpCon.getResponseCode() != HttpURLConnection.HTTP_OK)

{

errorString="Http error: " + httpCon.getResponseMessage();


}



}catch ( MalformedURLException e) { System.out.println(e); }

catch ( IOException e) { System.out.println(e); }




Also I want to print the errorStrteam from the server

could you pls help me to sole the problem





thanks


sabu

   <<Less
About | Sitemap | Contact