Http Post
Following code I m using for http posting. It is working fine. But from some URL, it is not getting any response and throws IO Exception on some m/c.
I tried with all the version of java. And I am using java 6 now.
It is working well, while running (posting) with my pc. But it throws exception on another m/c. [and for your information, that m/c is having Global IP & behind firewall.]
/*
post ( String url_to_post )
*/
URL url;
url =new URL ( url_to_post );
HttpURLConnection url_con ;
url_con = (HttpURLConnection)url.openConnection ();
url_con.connect();
int statusCode = url_con.getResponseCode();
System.out.println("statusCode"+statusCode);
InputStream _is =null;
try{
if ( statusCode<=400)
{
_is = url_con.getInputStream();
}
else{
_is = url_con.getErrorStream();
}
}
catch (IOException e){
throw e;
}
BufferedReader buffer =new
BufferedReader(new InputStreamReader (_is));
String result = buffer.readLine() ;
return result;

