Java 2 Micro Edition (J2ME)



           

Соединения содержимого соединений - часть 10


}

private void parse()

(

if (httpConn == null) return;

String protocol = httpConn.getProtocol();

contents.append("Protocol: " t protocol + "\n");

String type = httpConn.getType();

content's . append ("Type : " + type + "\n");

String encoding = httpConn.getEncoding ();

contents.append("Encoding: " + encoding + "\n");

long length = httpConn.getLength ();

contents.append("Length: " + length + "\n");

String uri = httpConn.getURL();

contents.append("URL: " + uri + "\n");

String host = httpConn.getHost();

contents.append("Host: " + host + "\n");

String query = httpConn.getQuery();

contents.append("Query: " + query + "\n");

String requestMethod = httpConn.getRequestMethod();

contents.append ("Method: " + requestMethod + "\n");

}

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:




Содержание  Назад  Вперед