I have a piece of Java code that opens a HTTP connection, writes data on that and then retrieves the response code. Since, the connectin was fine it should get HTTP_OK (i.e 200) but it is getting 1 in return.
This is baffling as 1 appears nowhere in the Http Response code specification. Could anyone throw some ideas on the potential problem area?
Following is the piece of code:
URL tempURL = new URL("http://www.google.com");
obj_URLHttpConnectionServlet = (HttpURLConnection)tempURL.openConnection();
obj_URLHttpConnectionServlet.setDoInput(true);
obj_URLHttpConnectionServlet.setDoOutput(true);
OutputStream obj_OutputStream = obj_URLHttpConnectionServlet.getOutputStream();
obj_OutputStream.write(sConfigurationData.getBytes());
obj_OutputStream.flush();
obj_OutputStream.close();
obj_OutputStream = null;
int iResponseCode = obj_URLHttpConnectionServlet.getResponseCode();
System.out.println("Response code received is : " + iResponseCode);
Output
Response code received is : 1