ofxHTTP
A collection of tools for HTTP.
ofx::HTTP::Context Class Reference

A Context is a collection of data that supports a client session. More...

#include <Context.h>

Public Member Functions

 Context ()
 Create a default Context.
 
 Context (const ClientSessionSettings &sessionSettings)
 Create a Context with the given settings. More...
 
virtual ~Context ()
 Destroy the Context.
 
void setClientSessionSettings (const ClientSessionSettings &sessionSettings)
 Set the ClientSessionSettings. More...
 
const ClientSessionSettingsgetClientSessionSettings () const
 
void setClientSession (std::unique_ptr< Poco::Net::HTTPClientSession > clientSession)
 Set the client session to use. More...
 
std::unique_ptr< Poco::Net::HTTPClientSession > releaseClientSession ()
 Release the client session. More...
 
Poco::Net::HTTPClientSession * clientSession ()
 Get a pointer to the current HTTP session for this context. More...
 
const Poco::Net::HTTPClientSession * clientSession () const
 Get a const pointer to the current HTTP session for this context. More...
 
void addRedirect (const Poco::URI &uri)
 Add to the history of redirects. More...
 
const std::vector< Poco::URI > & getRedirects () const
 
void setProxyRedirectURI (const Poco::URI &uri)
 Set the URI that should be used if a proxy is required. More...
 
const Poco::URI & getProxyRedirectURI () const
 
void setResubmit (bool resubmit)
 Set whether the current session should be resubmitted. More...
 
bool getResubmit () const
 
ClientState getState () const
 
void setState (ClientState state)
 

Public Attributes

ClientEvents events
 Client events.
 

Friends

class Client
 
class ClientSessionProvider
 

Detailed Description

A Context is a collection of data that supports a client session.

This Context stores various attributes including session settings, redirects cookie stores, etc.

Constructor & Destructor Documentation

◆ Context()

ofx::HTTP::Context::Context ( const ClientSessionSettings sessionSettings)

Create a Context with the given settings.

Parameters
settingsThe ClientSessionSettings to use.

Member Function Documentation

◆ addRedirect()

void ofx::HTTP::Context::addRedirect ( const Poco::URI &  uri)

Add to the history of redirects.

Parameters
uriThe URI to add.

◆ clientSession() [1/2]

Poco::Net::HTTPClientSession * ofx::HTTP::Context::clientSession ( )

Get a pointer to the current HTTP session for this context.

The context will retain ownership of the HTTP session.

Returns
a pointer to the current client session or nullptr if none set.

◆ clientSession() [2/2]

const Poco::Net::HTTPClientSession * ofx::HTTP::Context::clientSession ( ) const

Get a const pointer to the current HTTP session for this context.

The context will retain ownership of the HTTP session.

Returns
a const pointer to the current client session or nullptr if none set.

◆ getClientSessionSettings()

const ClientSessionSettings & ofx::HTTP::Context::getClientSessionSettings ( ) const
Returns
the ClientSessionSettings.

◆ getProxyRedirectURI()

const Poco::URI & ofx::HTTP::Context::getProxyRedirectURI ( ) const
Returns
the proxy redirect URI.
See also
DefaultProxyProcessor::requestFilter

◆ getRedirects()

const std::vector< Poco::URI > & ofx::HTTP::Context::getRedirects ( ) const
Returns
A list of all redurects followed by this client session.

◆ getResubmit()

bool ofx::HTTP::Context::getResubmit ( ) const
Returns
true if the current transaction needs to be resubmitted.

◆ getState()

ClientState ofx::HTTP::Context::getState ( ) const
Returns
the current state of the

◆ releaseClientSession()

std::unique_ptr< Poco::Net::HTTPClientSession > ofx::HTTP::Context::releaseClientSession ( )

Release the client session.

This is typically recalled by the client session provider to (possibly) be reused.

Returns
ownership of the client session via a unique_ptr.

◆ setClientSession()

void ofx::HTTP::Context::setClientSession ( std::unique_ptr< Poco::Net::HTTPClientSession >  clientSession)

Set the client session to use.

This is typically provided by the DefaultClientSessionProvider. The Context will take ownership of the HTTPClientSession.

Parameters
clientSessionThe client session to take ownership of.

◆ setClientSessionSettings()

void ofx::HTTP::Context::setClientSessionSettings ( const ClientSessionSettings sessionSettings)

Set the ClientSessionSettings.

Parameters
settingsThe ClientSessionSettings to set.

◆ setProxyRedirectURI()

void ofx::HTTP::Context::setProxyRedirectURI ( const Poco::URI &  uri)

Set the URI that should be used if a proxy is required.

Parameters
uriThe proxy redirect URI.
See also
DefaultProxyProcessor::responseFilter.

◆ setResubmit()

void ofx::HTTP::Context::setResubmit ( bool  resubmit)

Set whether the current session should be resubmitted.

Resubmits can be set if request filters require it (e.g. Proxy filters).

Parameters
resubmittrue if the associated request should be resubmitted.

The documentation for this class was generated from the following files: