System.out.println(ioe.getMessage());
ioe.printStackTrace();
}
}
private boolean resourceRelocated()
{
boolean relocated = false; try
}
status = httpConn.getResponseCode();
if (status == HttpConnection.HTTP_MOVED_TEMP II
status == HttpConnection.HTTP_MOVED_PERM II
status == HttpConnection.HTTP_TEMP_REDIRECT)
{
relocated = true;
}
}
catch (lOException ioe)
}
System.out.println(ioe.getMessage());
ioe.printStackTrace();
}
return relocated;
}
private boolean serverError ()
{
boolean error = false;
try
{
status = httpConn.getResponseCode();
if ((status == HttpConnection.HTTP_NOT_IMPLEMENTED)
If (status == HttpConnection.HTTP_VERSION)
If (status == HttpConnection.HTTP_INTERNAL_ERROR)
If (status = = HttpConnection.HTTP_GATEWAY_TIMEOUT)
If (status == HttpConnection.HTTP_BAD_GATEWAY))
}
error = true; } }
catch (lOException ioe)
{
error = true;
System.out.println(ioe.getMessage());
ioe.printStackTrace();
}
return error;
}
private void parse()
(
if (httpConn == null) return;
String protocol = httpConn.getProtocol();
contents.append('Protocol: ' t protocol + ' ');
String type = httpConn.getType();
content's. append ('Type: ' + type + ' ');
String encoding = httpConn.getEncoding ();
contents.append('Encoding: ' + encoding + ' ');
long length = httpConn.getLength ();
contents.append('Length: ' + length + ' ');
String uri = httpConn.getURL();
contents.append('URL: ' + uri + ' ');
String host = httpConn.getHost();
contents.append('Host: ' + host + ' ');
String query = httpConn.getQuery();
contents.append('Query: ' + query + ' ');
String requestMethod = httpConn.getRequestMethod();
contents.append ('Method: ' + requestMethod + ' ');
}
private void printResponseCode(int code)
{
System.out.print('Response code:
**/
switch (code) case HttpConnection.HTTP_ACCEPTED:
Systern.out.print In('HTTP_ACCEPTED'); break;
case HttpConnection.HTTP_BAD_GATEWAY:
Systern.out.print In('HTTP_BAD_GATEWAY'); break;
case HttpConnection.HTTP_BAD_METHOD:
Systern.out.print In('HTTP_BAD_METHOD'); break;
'case HttpConnection.HTTP_BAD_REQUEST:
Systern.out.print In('HTTP~BAD_REQUEST'); break;
case HttpCo-.nection.HTTP_CONFLICT:
System.out.println('HTTP_CONFLICT'); break;
case HttpConnection.HTTP_CREATED:
System.out.print In('HTTP_CREATED'); break;
case HttpConnection.HTTP_FORBIDDEN:
System.out.print In('HTTP_BAD_FORBIDDEN'); break;
case HttpConnection.HTTP_GATEWAY_TIMEOUT:
System.out.print In('HTTP_GATEWAY_TIMEOUT'); break;
case HttpConnection.HTTP_GONE:
Systern.out.print In('HTTP_GONE'); break;
case HttpConnection.HTTP_NO_CONTENT:
System.out.println('HTTP_NO_CONTENT'); break;
case HttpConnection.HTTP_NOT_ACCEPTABLE:
Systern.out.print In('HTTP_NOT_ACCEPTABLE'); break;
case HttpConnection.HTTP_NOT_FOUND:
System.out.print In('HTTP~NOT_FOUND'); break;
case HttpConnection.HTTP_OK:
System.out.println('HTTP_OK'); break;
case HttpConnection.HTTP_PROXY_AUTH:
Systern.out.print In('HTTP_PROXY_AUTH'); break;
case HttpConnection.HTTP_UNAVAILABLE:
Systern.out.print In('HTTP_UNAVAILABLE'); break;
case HttpConnection.HTTP_VERSION: