FileDocCategorySizeDatePackage
HttpConnection.javaAPI DocAndroid 1.5 API3111Wed May 06 22:41:56 BST 2009android.net.http

HttpConnection

public class HttpConnection extends Connection
A requestConnection connecting to a normal (non secure) http server {@hide}

Fields Summary
Constructors Summary
HttpConnection(android.content.Context context, HttpHost host, RequestQueue.ConnectionManager connectionManager, RequestFeeder requestFeeder)

        super(context, host, connectionManager, requestFeeder);
    
Methods Summary
voidcloseConnection()
Closes the low level connection. If an exception is thrown then it is assumed that the connection will have been closed (to the extent possible) anyway and the caller does not need to take any further action.

        try {
            if (mHttpClientConnection != null && mHttpClientConnection.isOpen()) {
                mHttpClientConnection.close();
            }
        } catch (IOException e) {
            if (HttpLog.LOGV) HttpLog.v(
                    "closeConnection(): failed closing connection " +
                    mHost);
            e.printStackTrace();
        }
    
java.lang.StringgetScheme()

        return "http";
    
AndroidHttpClientConnectionopenConnection(Request req)
Opens the connection to a http server

return
the opened low level connection
throws
IOException if the connection fails for any reason.


        // Update the certificate info (connection not secure - set to null)
        EventHandler eventHandler = req.getEventHandler();
        mCertificate = null;
        eventHandler.certificate(mCertificate);

        AndroidHttpClientConnection conn = new AndroidHttpClientConnection();
        BasicHttpParams params = new BasicHttpParams();
        Socket sock = new Socket(mHost.getHostName(), mHost.getPort());
        params.setIntParameter(HttpConnectionParams.SOCKET_BUFFER_SIZE, 8192);
        conn.bind(sock, params);
        return conn;
    
voidrestartConnection(boolean abort)
Restart a secure connection suspended waiting for user interaction.

        // not required for plain http connections