void printinfo(HttpConnection c) throws Exception
{
System.out.println("***HTTP连接信息***");
System.out.println("Method="+c.getRequestMethod());
System.out.println("URL="+c.getURL());
System.out.println("Protocol="+c.getProtocol());
System.out.println("Host="+c.getHost());
System.out.println("File="+c.getFile());
System.out.println("Port="+c.getPort());
int rc=c.getResponseCode();
if(rc!=HttpConnection.HTTP_OK)
{
throw new IOException("HTTP response code:"+rc);
}
System.out.println("ResponseCode="+rc);
System.out.println("ResponseMessage="+c.getResponseMessage());
String key;
for(int i=0;null!=(key=c.getHeaderFieldKey(i));i++)
{
System.out.println(key+"="+c.getHeaderField(i));
}
}
{
System.out.println("***HTTP连接信息***");
System.out.println("Method="+c.getRequestMethod());
System.out.println("URL="+c.getURL());
System.out.println("Protocol="+c.getProtocol());
System.out.println("Host="+c.getHost());
System.out.println("File="+c.getFile());
System.out.println("Port="+c.getPort());
int rc=c.getResponseCode();
if(rc!=HttpConnection.HTTP_OK)
{
throw new IOException("HTTP response code:"+rc);
}
System.out.println("ResponseCode="+rc);
System.out.println("ResponseMessage="+c.getResponseMessage());
String key;
for(int i=0;null!=(key=c.getHeaderFieldKey(i));i++)
{
System.out.println(key+"="+c.getHeaderField(i));
}
}