• BlackBerry Dynamics
  • Runtime library for Android applications
  • 12.0.1.79
HttpClientConnection Interface Reference

An HTTP connection for use on the client side. More...

Inheritance diagram for HttpClientConnection:
HttpConnection ManagedClientConnection OperatedClientConnection AbstractClientConnAdapter DefaultClientConnection AbstractPooledConnAdapter SingleClientConnManager.ConnAdapter BasicPooledConnAdapter

Description

It is used for sending requests and receiving responses.

Author
Oleg Kalnichevski
Version
Revision
542199
Since
4.0

Notice

The following notice applies to the original API on which this API is based, and to its documentation. The documentation of this API has been revised from the original.

/*
 * Copyright (C) 2006 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

Public Member Functions

boolean isResponseAvailable (int timeout) throws IOException
 Checks if response data is available from the connection. More...
 
void sendRequestHeader (HttpRequest request) throws HttpException, IOException
 Sends the request line and all headers over the connection. More...
 
void sendRequestEntity (HttpEntityEnclosingRequest request) throws HttpException, IOException
 Sends the request entity over the connection. More...
 
HttpResponse receiveResponseHeader () throws HttpException, IOException
 Receives the request line and headers of the next response available from this connection. More...
 
void receiveResponseEntity (HttpResponse response) throws HttpException, IOException
 Receives the next response entity available from this connection and attaches it to an existing HttpResponse object. More...
 
void flush () throws IOException
 Writes out all pending buffered data over the open connection. More...
 
- Public Member Functions inherited from HttpConnection
void close () throws IOException
 Closes this connection gracefully. More...
 
boolean isOpen ()
 Checks if this connection is open. More...
 
boolean isStale ()
 Checks whether this connection has gone down. More...
 
void setSocketTimeout (int timeout)
 Sets the socket timeout value. More...
 
int getSocketTimeout ()
 Returns the socket timeout value. More...
 
void shutdown () throws IOException
 Force-closes this connection. More...
 
HttpConnectionMetrics getMetrics ()
 Returns a collection of connection metrcis. More...
 

Member Function Documentation

◆ isResponseAvailable()

boolean isResponseAvailable ( int  timeout) throws IOException

May wait for the specified time until some data becomes available. Note that some implementations may completely ignore the timeout parameter.

Parameters
timeoutthe maximum time in milliseconds to wait for data
Returns
true if data is available; false if there was no data available even after waiting for timeout milliseconds.
Exceptions
IOExceptionif an error happens on the connection

Implemented in AbstractClientConnAdapter.

◆ sendRequestHeader()

void sendRequestHeader ( HttpRequest  request) throws HttpException, IOException
Parameters
requestthe request whose headers to send.
Exceptions
HttpException
IOException

Implemented in AbstractClientConnAdapter, and DefaultClientConnection.

◆ sendRequestEntity()

void sendRequestEntity ( HttpEntityEnclosingRequest  request) throws HttpException, IOException
Parameters
requestthe request whose entity to send.
Exceptions
HttpException
IOException

Implemented in AbstractClientConnAdapter.

◆ receiveResponseHeader()

HttpResponse receiveResponseHeader ( ) throws HttpException, IOException

The caller should examine the HttpResponse object to find out if it should try to receive a response entity as well.

Returns
a new HttpResponse object with status line and headers initialized.
Exceptions
HttpException
IOException

Implemented in AbstractClientConnAdapter, and DefaultClientConnection.

◆ receiveResponseEntity()

void receiveResponseEntity ( HttpResponse  response) throws HttpException, IOException
Parameters
responsethe response to attach the entity to
Exceptions
HttpException
IOException

Implemented in AbstractClientConnAdapter.

◆ flush()

void flush ( ) throws IOException
Exceptions
IOException

Implemented in AbstractClientConnAdapter.