FlightGear next
flightgear::http::URIHandler Class Reference

A Base class for URI Handlers. More...

#include <urihandler.hxx>

Inherits SGReferenced.

Inherited by flightgear::http::FlightHistoryUriHandler, flightgear::http::JsonUriHandler, flightgear::http::NavdbUriHandler, flightgear::http::PkgUriHandler, flightgear::http::PropertyUriHandler, flightgear::http::RunUriHandler, and flightgear::http::ScreenshotUriHandler.

Public Member Functions

 URIHandler (const std::string &uri)
 
virtual ~URIHandler ()
 
virtual bool handleRequest (const HTTPRequest &request, HTTPResponse &response, Connection *connection=NULL)
 This method gets called from the httpd if a request has been detected on the connection.
 
virtual bool handleGetRequest (const HTTPRequest &request, HTTPResponse &response, Connection *connection)
 Convenience method for GET Requests, gets called by handleRequest if not overridden.
 
virtual bool handlePutRequest (const HTTPRequest &request, HTTPResponse &response, Connection *connection)
 Convenience method for PUT Requests, gets called by handleRequest if not overridden.
 
virtual bool poll (Connection *connection)
 This method gets called from the httpd if the preceding handleRequest() or poll() method returned false.
 
const std::string & getUri () const
 Getter for the URI this handler serves.
 

Detailed Description

A Base class for URI Handlers.

Provides methods for handling a request and handling subsequent polls. All methods are implemented as noops and should be overridden by deriving classes

Definition at line 64 of file urihandler.hxx.

Constructor & Destructor Documentation

◆ URIHandler()

flightgear::http::URIHandler::URIHandler ( const std::string & uri)
inline

Definition at line 66 of file urihandler.hxx.

◆ ~URIHandler()

virtual flightgear::http::URIHandler::~URIHandler ( )
inlinevirtual

Definition at line 67 of file urihandler.hxx.

Member Function Documentation

◆ getUri()

const std::string & flightgear::http::URIHandler::getUri ( ) const
inline

Getter for the URI this handler serves.

Returns
the URI this handler serves

Definition at line 118 of file urihandler.hxx.

◆ handleGetRequest()

virtual bool flightgear::http::URIHandler::handleGetRequest ( const HTTPRequest & request,
HTTPResponse & response,
Connection * connection )
inlinevirtual

Convenience method for GET Requests, gets called by handleRequest if not overridden.

Parameters
request
See also
handleRequest()
Parameters
response
See also
handleRequest()
Parameters
connection
See also
handleRequest()
Returns
See also
handleRequest()

Reimplemented in flightgear::http::PropertyUriHandler, and flightgear::http::ScreenshotUriHandler.

Definition at line 90 of file urihandler.hxx.

◆ handlePutRequest()

virtual bool flightgear::http::URIHandler::handlePutRequest ( const HTTPRequest & request,
HTTPResponse & response,
Connection * connection )
inlinevirtual

Convenience method for PUT Requests, gets called by handleRequest if not overridden.

Parameters
request
See also
handleRequest()
Parameters
response
See also
handleRequest()
Parameters
connection
See also
handleRequest()
Returns
See also
handleRequest()

Definition at line 102 of file urihandler.hxx.

◆ handleRequest()

virtual bool flightgear::http::URIHandler::handleRequest ( const HTTPRequest & request,
HTTPResponse & response,
Connection * connection = NULL )
inlinevirtual

This method gets called from the httpd if a request has been detected on the connection.

Parameters
requestThe HTTP Request filled in by the httpd
responsethe HTTP Response to be filled in by the hander
connectionConnection specific information, can be used to store persistent state
Returns
true if the request has been completely answered, false to get poll()ed

Reimplemented in flightgear::http::FlightHistoryUriHandler, flightgear::http::JsonUriHandler, flightgear::http::NavdbUriHandler, flightgear::http::PkgUriHandler, and flightgear::http::RunUriHandler.

Definition at line 76 of file urihandler.hxx.

◆ poll()

virtual bool flightgear::http::URIHandler::poll ( Connection * connection)
inlinevirtual

This method gets called from the httpd if the preceding handleRequest() or poll() method returned false.

Parameters
connection
See also
handleRequest()
Returns
See also
handleRequest()

Reimplemented in flightgear::http::ScreenshotUriHandler.

Definition at line 111 of file urihandler.hxx.


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