• BlackBerry Dynamics
  • Runtime library for Android applications
  • 12.0.1.79
DefaultRequestDirector Class Reference

Default implementation of com.good.gd.apache.http.client.RequestDirector. More...

Inheritance diagram for DefaultRequestDirector:
RequestDirector

Description


This class replaces the HttpMethodDirector in HttpClient 3.

Author
Roland Weber
Oleg Kalnichevski
Version
Revision
676023
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

HttpResponse execute (HttpHost target, HttpRequest request, HttpContext context) throws HttpException, IOException
 Executes a request. More...
 

Protected Member Functions

void releaseConnection ()
 Returns the connection back to the connection manager and prepares for retrieving a new connection during the next request.
 
HttpRoute determineRoute (HttpHost target, HttpRequest request, HttpContext context) throws HttpException
 Determines the route for a request. More...
 
void establishRoute (HttpRoute route, HttpContext context) throws HttpException, IOException
 Establishes the target route. More...
 
boolean createTunnelToTarget (HttpRoute route, HttpContext context) throws HttpException, IOException
 Creates a tunnel to the target server. More...
 
boolean createTunnelToProxy (HttpRoute route, int hop, HttpContext context) throws HttpException, IOException
 Creates a tunnel to an intermediate proxy. More...
 
HttpRequest createConnectRequest (HttpRoute route, HttpContext context)
 Creates the CONNECT request for tunnelling. More...
 
RoutedRequest handleResponse (RoutedRequest roureq, HttpResponse response, HttpContext context) throws HttpException, IOException
 Analyzes a response to check need for a followup. More...
 

Protected Attributes

final ClientConnectionManager connManager
 The connection manager. More...
 
final HttpRoutePlanner routePlanner
 The route planner. More...
 
final ConnectionReuseStrategy reuseStrategy
 The connection re-use strategy. More...
 
final ConnectionKeepAliveStrategy keepAliveStrategy
 The keep-alive duration strategy. More...
 
final HttpRequestExecutor requestExec
 The request executor. More...
 
final HttpProcessor httpProcessor
 The HTTP protocol processor. More...
 
final HttpRequestRetryHandler retryHandler
 The request retry handler. More...
 
final RedirectHandler redirectHandler
 The redirect handler. More...
 
final HttpParams params
 The HTTP parameters. More...
 
ManagedClientConnection managedConn
 The currently allocated connection. More...
 

Member Function Documentation

◆ execute()

HttpResponse execute ( HttpHost  target,
HttpRequest  request,
HttpContext  context 
) throws HttpException, IOException


Note: For the time being, a new director is instantiated for each request. This is the same behavior as for HttpMethodDirector in HttpClient 3.

Parameters
targetthe target host for the request. Implementations may accept null if they can still determine a route, for example to a default target or by inspecting the request.
requestthe request to execute
contextthe context for executing the request
Returns
the final response to the request. This is never an intermediate response with status code 1xx.
Exceptions
HttpExceptionin case of a problem
IOExceptionin case of an IO problem or if the connection was aborted

Implements RequestDirector.

◆ determineRoute()

HttpRoute determineRoute ( HttpHost  target,
HttpRequest  request,
HttpContext  context 
) throws HttpException
protected

Called by execute to determine the route for either the original or a followup request.

Parameters
targetthe target host for the request. Implementations may accept null if they can still determine a route, for example to a default target or by inspecting the request.
requestthe request to execute
contextthe context to use for the execution, never null
Returns
the route the request should take
Exceptions
HttpExceptionin case of a problem

◆ establishRoute()

void establishRoute ( HttpRoute  route,
HttpContext  context 
) throws HttpException, IOException
protected
Parameters
routethe route to establish
contextthe context for the request execution
Exceptions
HttpExceptionin case of a problem
IOExceptionin case of an IO problem

◆ createTunnelToTarget()

boolean createTunnelToTarget ( HttpRoute  route,
HttpContext  context 
) throws HttpException, IOException
protected

The connection must be established to the (last) proxy. A CONNECT request for tunnelling through the proxy will be created and sent, the response received and checked. This method does not update the connection with information about the tunnel, that is left to the caller.

Parameters
routethe route to establish
contextthe context for request execution
Returns
true if the tunnelled route is secure, false otherwise. The implementation here always returns false, but derived classes may override.
Exceptions
HttpExceptionin case of a problem
IOExceptionin case of an IO problem

◆ createTunnelToProxy()

boolean createTunnelToProxy ( HttpRoute  route,
int  hop,
HttpContext  context 
) throws HttpException, IOException
protected

This method is not implemented in this class. It just throws an exception here.

Parameters
routethe route to establish
hopthe hop in the route to establish now. route.getHopTarget(hop) will return the proxy to tunnel to.
contextthe context for request execution
Returns
true if the partially tunnelled connection is secure, false otherwise.
Exceptions
HttpExceptionin case of a problem
IOExceptionin case of an IO problem

◆ createConnectRequest()

HttpRequest createConnectRequest ( HttpRoute  route,
HttpContext  context 
)
protected

Called by createTunnelToTarget .

Parameters
routethe route to establish
contextthe context for request execution
Returns
the CONNECT request for tunnelling

◆ handleResponse()

RoutedRequest handleResponse ( RoutedRequest  roureq,
HttpResponse  response,
HttpContext  context 
) throws HttpException, IOException
protected
Parameters
roureqthe request and route.
responsethe response to analayze
contextthe context used for the current request execution
Returns
the followup request and route if there is a followup, or null if the response should be returned as is
Exceptions
HttpExceptionin case of a problem
IOExceptionin case of an IO problem

Member Data Documentation

◆ connManager

final ClientConnectionManager connManager
protected

◆ routePlanner

final HttpRoutePlanner routePlanner
protected

◆ reuseStrategy

final ConnectionReuseStrategy reuseStrategy
protected

◆ keepAliveStrategy

final ConnectionKeepAliveStrategy keepAliveStrategy
protected

◆ requestExec

final HttpRequestExecutor requestExec
protected

◆ httpProcessor

final HttpProcessor httpProcessor
protected

◆ retryHandler

final HttpRequestRetryHandler retryHandler
protected

◆ redirectHandler

final RedirectHandler redirectHandler
protected

◆ params

final HttpParams params
protected

◆ managedConn

ManagedClientConnection managedConn
protected