Daraja HTTP Framework 3.4.0-SNAPSHOT
HTTP server framework for Object Pascal
Loading...
Searching...
No Matches
IHandlerContainer Interface Reference

Interface for components that can contain multiple handlers. More...

Inheritance diagram for IHandlerContainer:
IHandler TdjAbstractHandlerContainer ILifeCycle TdjServerBase TdjServer

Public Member Functions

 AddHandler (const IHandler Handler)
 Adds a handler to this container.
 Handle (const string Target, TdjServerContext Context, TdjRequest Request, TdjResponse Response)
 Handles an HTTP request.
boolean IsStarted ()
boolean IsStopped ()
 RemoveHandler (const IHandler Handler)
 Removes a handler from this container.
 Start ()
 Starts the component.
 Stop ()
 Stops the component.

Public Attributes

Boolean StrictStart
 When True, a handler in this collection that fails to start makes Start raise instead of logging the failure and continuing with the remaining handlers.

Protected Member Functions

 Handle (const string Target, TdjServerContext Context, TdjRequest Request, TdjResponse Response)
 SetStrictStart (const Boolean Value)

Protected Attributes

TdjHandlers FHandlers
 The handler collection.

Detailed Description

Interface for components that can contain multiple handlers.

Member Function Documentation

◆ AddHandler()

IHandlerContainer::AddHandler ( const IHandler Handler)

Adds a handler to this container.

Parameters
HandlerHandler to add

Implements IHandler.

◆ Handle() [1/2]

IHandler::Handle ( const string Target,
TdjServerContext Context,
TdjRequest Request,
TdjResponse Response )
protectedinherited

◆ Handle() [2/2]

IHandler::Handle ( const string Target,
TdjServerContext Context,
TdjRequest Request,
TdjResponse Response )
inherited

Handles an HTTP request.

Parameters
TargetTarget path or resource identifier
ContextServer context for this request
RequestHTTP request object
ResponseHTTP response object to populate
Exceptions
EDarajaExceptionif an exception occurs that interferes with the component's normal operation.

Implemented in TdjAbstractHandler, TdjServerBase, and TdjWebComponentHandler.

◆ IsStarted()

boolean ILifeCycle::IsStarted ( )
inherited
Returns
True if component is started

Implemented in TdjLifeCycle.

Referenced by TdjServer::ConnectorCount(), and Stop().

◆ IsStopped()

boolean ILifeCycle::IsStopped ( )
inherited
Returns
True if component is stopped

Implemented in TdjLifeCycle.

◆ RemoveHandler()

IHandlerContainer::RemoveHandler ( const IHandler Handler)

Removes a handler from this container.

Parameters
HandlerHandler to remove

Implements IHandler.

◆ SetStrictStart()

IHandler::SetStrictStart ( const Boolean Value)
protectedinherited

◆ Start()

ILifeCycle::Start ( )
inherited

Starts the component.

Implemented in TdjLifeCycle.

References Start().

Referenced by TdjServer::AddConnector(), IHandler::Handle(), TdjServer::RemoveConnector(), and Start().

◆ Stop()

ILifeCycle::Stop ( )
inherited

Stops the component.

Note
Unlike Start, a failure in the custom stop code is logged and swallowed rather than re-raised; the component is still marked stopped.

Implemented in TdjLifeCycle.

References IsStarted().

Referenced by TdjServer::ConnectorCount().

Member Data Documentation

◆ FHandlers

TdjHandlers IHandler::FHandlers
protectedinherited

The handler collection.

◆ StrictStart

Boolean IHandler::StrictStart
inherited

When True, a handler in this collection that fails to start makes Start raise instead of logging the failure and continuing with the remaining handlers.

Defaults to False, preserving the collection's traditional best-effort behavior.

Setting this to True also propagates it to any handler in the collection that supports strict start itself (e.g. a nested context), so the setting reaches the whole subtree below this collection.

Exceptions
Exceptionif this collection is already started.