Google APIs Client Library for C++
HttpTransportErrorHandler Class Reference

forward declaration More...

#include "client/transport/http_transport.h"

+ Inheritance diagram for HttpTransportErrorHandler:

List of all members.

Public Types

typedef ResultCallback2< bool,
int, HttpRequest * > 
HttpCodeHandler
 Callback for handling a specific HTTP status code.

Public Member Functions

void ResetHttpCodeHandler (int code, HttpCodeHandler *handler)
 Replaces the existing handler for a given HTTP status code.
 HttpTransportErrorHandler ()
 Standard constructor.
virtual ~HttpTransportErrorHandler ()
 Standard destructor.
virtual bool HandleTransportError (int num_retries_so_far, HttpRequest *request) const
 Handles transport errors.
virtual bool HandleRedirect (int num_redirects_so_far, HttpRequest *request) const
 Handles HTTP redirects (HTTP 3xx series results).
virtual bool HandleHttpError (int num_retries_so_far, HttpRequest *request) const
 Handles erorrs from requests with HTTP status code errors.

Detailed Description

forward declaration

Specifies the error handling policy for HTTP messaging.

This class specifies the policy for different types of errors including:

  • Transport erors
  • HTTP redirect responses
  • HTTP error response codes

Instances can further refine specific error handling for individual HTTP status codes.

See also:
HttpRequest

Member Typedef Documentation

typedef ResultCallback2<bool, int, HttpRequest*> HttpCodeHandler

Callback for handling a specific HTTP status code.

Parameters:
[in]intThe HTTP status code.
[in]HttpRequestThe request that had the error.
Returns:
true if the callback requests a retry, false if not.

The callback and make changes to the request to indicate how to perform a retry.


Constructor & Destructor Documentation

Standard constructor.

virtual ~HttpTransportErrorHandler ( ) [virtual]

Standard destructor.


Member Function Documentation

virtual bool HandleHttpError ( int  num_retries_so_far,
HttpRequest request 
) const [virtual]

Handles erorrs from requests with HTTP status code errors.

This includes 401 (Authorization) and 503 (Unavailable)

Parameters:
[in]num_retries_so_farNumber of retries performed already.
[in]requestThe request that returned the error.
Returns:
true if we should consider trying again, policy permitting.
See also:
ResetHttpCodeHandler for overriding this behavior before subclassing.
virtual bool HandleRedirect ( int  num_redirects_so_far,
HttpRequest request 
) const [virtual]

Handles HTTP redirects (HTTP 3xx series results).

Parameters:
[in]num_redirects_so_farNumber of redirects already followed.
[in]requestThe request that caused the error.
Returns:
true if we should consider trying again, policy permitting.
virtual bool HandleTransportError ( int  num_retries_so_far,
HttpRequest request 
) const [virtual]

Handles transport errors.

Parameters:
[in]num_retries_so_farNumber of retries performed already.
[in]requestThe request that caused the error.
Returns:
true if we should consider trying again, policy permitting.
void ResetHttpCodeHandler ( int  code,
HttpCodeHandler handler 
)

Replaces the existing handler for a given HTTP status code.

Parameters:
[in]codeThe HTTP status code to handle.
[in]handlerThe handler to use can be NULL to remove it. Ownership is passed. non-NULL handlers must be a repeatable callback since it can be alled multiple times.
See also:
NewPermanentCallback()

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines