RestLink 2.2.0
Powerfull Rest Client for Qt
Loading...
Searching...
No Matches
Public Member Functions | List of all members
RestLink::AbstractController Class Referenceabstract

Defines the base interface for all server-side controllers. More...

#include <abstractcontroller.h>

Inherited by RestLink::AbstractResourceController.

Public Member Functions

 AbstractController ()
 
virtual ~AbstractController ()
 
virtual QString endpoint () const =0
 Returns the base endpoint this controller is responsible for.
 
virtual bool canProcessRequest (const ServerRequest &request) const
 Determines whether the controller can process the given request.
 
virtual void processRequest (const ServerRequest &request, ServerResponse *response)=0
 Processes the incoming request and writes the response.
 
void * dataSource () const
 Returns the data source associated with this controller.
 
void setDataSource (void *source)
 Sets the data source for the controller.
 

Detailed Description

Defines the base interface for all server-side controllers.

This class provides a contract for handling incoming server requests. Subclasses must implement the endpoint(), canProcessRequest() and processRequest() methods. A generic data source can be associated with the controller using setDataSource(), the RestLink SQL plugin will set a QSqlDatabase instance for example.

Constructor & Destructor Documentation

◆ AbstractController()

RestLink::AbstractController::AbstractController ( )
explicit

◆ ~AbstractController()

RestLink::AbstractController::~AbstractController ( )
virtual

Member Function Documentation

◆ endpoint()

QString RestLink::AbstractController::endpoint ( ) const
pure virtual

Returns the base endpoint this controller is responsible for.

◆ canProcessRequest()

bool RestLink::AbstractController::canProcessRequest ( const ServerRequest request) const
virtual

Determines whether the controller can process the given request.

Reimplemented in RestLink::AbstractResourceController.

◆ processRequest()

void RestLink::AbstractController::processRequest ( const ServerRequest request,
ServerResponse response 
)
pure virtual

Processes the incoming request and writes the response.

Implemented in RestLink::AbstractResourceController.

◆ dataSource()

void * RestLink::AbstractController::dataSource ( ) const

Returns the data source associated with this controller.

◆ setDataSource()

void RestLink::AbstractController::setDataSource ( void *  source)

Sets the data source for the controller.

Parameters
sourceA generic pointer to a data source, typically used by the controller to retrieve or manipulate data.