ofxHTTP
A collection of tools for HTTP.
|
A base HTTP cient for executing HTTP client requests. More...
#include <Client.h>
Public Member Functions | |
Client () | |
Create a Client. | |
virtual | ~Client () |
Destroy the Client. | |
virtual Context & | context () |
Access the local context for the client. More... | |
std::unique_ptr< Response > | execute (Request &request) |
Execute an HTTP Request with the default client context. More... | |
std::unique_ptr< Response > | execute (Context &context, Request &request) |
Execute an HTTP Request with the given context. More... | |
void | submit (Request &request) |
Execute an HTTP Request with the default client context. More... | |
void | submit (Context &context, Request &request) |
Execute an HTTP Request with the given context. More... | |
template<typename ReturnType > | |
ReturnType | execute (Context &context, Request &request, ResponseHandler< ReturnType > &handler) |
template<typename ReturnType > | |
ReturnType | execute (Context &context, Request &request, std::function< ReturnType(Context &, Request &, Response &)> f) |
template<typename ReturnType > | |
ReturnType | execute (Context &context, Request &request, std::function< ReturnType(Response &)> f) |
Protected Member Functions | |
virtual void | requestFilter (Context &context, Request &request) const override |
virtual void | responseFilter (Context &context, Request &request, Response &response) const override |
|
virtual |
Access the local context for the client.
The context is used when a context is not provided to the executing function.
void ofx::HTTP::Client::submit | ( | Request & | request | ) |
Execute an HTTP Request with the default client context.
This does not throw exceptions but sends everything to listeners in the default context. e.g.
context.events.onHTTPClientStateChange context.events.onHTTPClientRequestProgress context.events.onHTTPClientResponseProgress context.events.onHTTPClientResponseStream context.events.onHTTPClientError ...
request | The request to execute. |
Execute an HTTP Request with the given context.
This does not throw exceptions but sends everything to listeners in the given context. e.g.
context.events.onHTTPClientStateChange context.events.onHTTPClientRequestProgress context.events.onHTTPClientResponseProgress context.events.onHTTPClientResponseStream context.events.onHTTPClientError ...
context | The execution context to use. |
request | The request to execute. |