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

A client-side connection that relies on outside logic to connect sockets to the appropriate hosts. More...

Inheritance diagram for OperatedClientConnection:
HttpClientConnection HttpInetConnection HttpConnection HttpConnection DefaultClientConnection

Description

It can be operated directly by an application, or through an operator .

Author
Roland Weber
Version
Revision
646087
Date
2008-04-08 14:36:46 -0700 (Tue, 08 Apr 2008)
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

HttpHost getTargetHost ()
 Obtains the target host for this connection. More...
 
boolean isSecure ()
 Indicates whether this connection is secure. More...
 
Socket getSocket ()
 Obtains the socket for this connection. More...
 
void opening (Socket sock, HttpHost target) throws IOException
 Signals that this connection is in the process of being open. More...
 
void openCompleted (boolean secure, HttpParams params) throws IOException
 Signals that the connection has been successfully open. More...
 
void update (Socket sock, HttpHost target, boolean secure, HttpParams params) throws IOException
 Updates this connection. More...
 
- Public Member Functions inherited from HttpClientConnection
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

◆ getTargetHost()

HttpHost getTargetHost ( )

If the connection is to a proxy but not tunnelled, this is the proxy. If the connection is tunnelled through a proxy, this is the target of the tunnel.
The return value is well-defined only while the connection is open. It may change even while the connection is open, because of an update .

Returns
the host to which this connection is opened

Implemented in DefaultClientConnection.

◆ isSecure()

boolean isSecure ( )

The return value is well-defined only while the connection is open. It may change even while the connection is open, because of an update .

Returns
true if this connection is secure, false otherwise

Implemented in DefaultClientConnection.

◆ getSocket()

Socket getSocket ( )

The return value is well-defined only while the connection is open. It may change even while the connection is open, because of an update .

Returns
the socket for communicating with the target host

Implemented in DefaultClientConnection.

◆ opening()

void opening ( Socket  sock,
HttpHost  target 
) throws IOException


By calling this method, you can provide the connection with the unconnected socket that will be connected before openCompleted is called. This allows the connection to close that socket if shutdown is called before it is open. Closing the unconnected socket will interrupt a thread that is blocked on the connect. Otherwise, that thread will either time out on the connect, or it returns successfully and then opens this connection which was just shut down.
You also must call openCompleted in order to complete the process

Parameters
sockthe unconnected socket which is about to be connected.
targetthe target host of this connection

Implemented in DefaultClientConnection.

◆ openCompleted()

void openCompleted ( boolean  secure,
HttpParams  params 
) throws IOException

An attempt to call this method on an open connection will cause an exception.

Parameters
securetrue if this connection is secure, for example if an SSLSocket is used, or false if it is not secure
paramsparameters for this connection. The parameters will be used when creating dependent objects, for example to determine buffer sizes.

Implemented in DefaultClientConnection.

◆ update()

void update ( Socket  sock,
HttpHost  target,
boolean  secure,
HttpParams  params 
) throws IOException

A connection can be updated only while it is open. Updates are used for example when a tunnel has been established, or when a TLS/SSL connection has been layered on top of a plain socket connection.
Note: Updating the connection will not close the previously used socket. It is the caller's responsibility to close that socket if it is no longer required.

Parameters
sockthe new socket for communicating with the target host, or null to continue using the old socket. If null is passed, helper objects that depend on the socket should be re-used. In that case, some changes in the parameters will not take effect.
targetthe new target host of this connection
securetrue if this connection is now secure, false if it is not secure
paramsnew parameters for this connection

Implemented in DefaultClientConnection.