Google APIs Client Library for C++
|
A high level but still abstract class for intercepting HTTP requests. More...
#include "client/transport/http_scribe.h"
Classes | |
class | Entry |
Public Member Functions | |
virtual void | AboutToSendRequest (const HttpRequest *request) |
Implements the HttpScribe::AboutToSendRequest method. | |
virtual void | ReceivedResponseForRequest (const HttpRequest *request) |
Implements the HttpScribe::ReceivedResponseForRequest method. | |
virtual void | RequestFailedWithTransportError (const HttpRequest *request, const util::Status &error) |
Implements the HttpScribe::RequestFailedWithTransportError method. | |
Protected Member Functions | |
HttpEntryScribe (HttpScribeCensor *censor) | |
Standard constructor. | |
virtual | ~HttpEntryScribe () |
Standard destructor. | |
Entry * | GetEntry (const HttpRequest *request) LOCKS_EXCLUDED(mutex_) |
Maps the request into a logical entry. | |
void | DiscardEntry (Entry *entry) LOCKS_EXCLUDED(mutex_) |
Unmaps and destroys the logical entry. | |
void | DiscardQueue () |
Discard all the entries in the queue. | |
virtual Entry * | NewEntry (const HttpRequest *request)=0 |
Create a new entry instance for the request. | |
queue< Entry * > * | outstanding_queue () |
Returns the entries that have not yet been unmapped. |
A high level but still abstract class for intercepting HTTP requests.
This class manages a collection of active HttpEntryScribe::Entry instances with activity associated with them. This might be a more useful starting point for viewing a collection of independent encapsulated messages as opposed to a stream of interleaved events.
HttpEntryScribe | ( | HttpScribeCensor * | censor | ) | [explicit, protected] |
Standard constructor.
[in] | censor | Ownership to the censorship policy is passed. |
virtual ~HttpEntryScribe | ( | ) | [protected, virtual] |
Standard destructor.
virtual void AboutToSendRequest | ( | const HttpRequest * | request | ) | [virtual] |
Implements the HttpScribe::AboutToSendRequest method.
This maps the request to an entry and calls the Entry::Sent method.
[in] | request | The request that was sent. |
Implements HttpScribe.
void DiscardEntry | ( | Entry * | entry | ) | [protected] |
Unmaps and destroys the logical entry.
This can be called to forget about the entry, but is normally handled automatically by this scribe instance.
[in,out] | entry | The entry will be destroyed. |
void DiscardQueue | ( | ) | [protected] |
Discard all the entries in the queue.
Discarding the entries notifies the entry that it is done so it can flush and remove itself. This method is here so that derived destructors can call it if they need to finish the entry before they destruct.
The base class will call this to discard anything remaining in its destructor.
Entry* GetEntry | ( | const HttpRequest * | request | ) | [protected] |
Maps the request into a logical entry.
[in] | request | The intercepted request. |
virtual Entry* NewEntry | ( | const HttpRequest * | request | ) | [protected, pure virtual] |
Create a new entry instance for the request.
This is called from within a critical section so does not have to worry about threads.
This lets specialized scribes return specialized entries that drive the particular specialized behavior. It is called by GetEntry.
Implemented in JsonScribe, and HtmlScribe.
queue<Entry*>* outstanding_queue | ( | ) | [inline, protected] |
Returns the entries that have not yet been unmapped.
These are in the order they were created, which is probably the order in which they were sent (minus race conditions).
virtual void ReceivedResponseForRequest | ( | const HttpRequest * | request | ) | [virtual] |
Implements the HttpScribe::ReceivedResponseForRequest method.
This maps the request to an entry and calls the Entry::Received method.
[in] | request | The request whose response was received. |
Implements HttpScribe.
virtual void RequestFailedWithTransportError | ( | const HttpRequest * | request, |
const util::Status & | error | ||
) | [virtual] |
Implements the HttpScribe::RequestFailedWithTransportError method.
This maps the request to an entry and calls the Entry::Failed method.
[in] | request | The request that had a transport failure. |
[in] | error | An explanation of the failure. |
Implements HttpScribe.