Daraja HTTP Framework 3.0.7-SNAPSHOT
HTTP server framework for Object Pascal
Loading...
Searching...
No Matches
TdjHandlerWrapper Class Reference

A HandlerWrapper acts as a IHandler but delegates the handle method and life cycle events to a delegate. More...

Inheritance diagram for TdjHandlerWrapper:
TdjAbstractHandlerContainer TdjAbstractHandler IHandlerContainer TdjLifeCycle IHandler ILifeCycle TdjContextHandler TdjServerBase TdjWebComponentContextHandler TdjServer TdjWebAppContext

Public Member Functions

 TdjHandlerWrapper ()
 AddHandler (const IHandler Handler)
 Add a handler to the container.
Boolean IsStarted ()
Boolean IsStopped ()
 RemoveHandler (const IHandler Handler)
 Removes a handler from this container.
 Start ()
 Starts the component.
 Stop ()
 Stops the component.

Public Attributes

IHandler Handler
Boolean Started
Boolean Stopped

Protected Member Functions

 CheckStarted ()
 Raises an exception if the lifecycle is in "started" state.
 CheckStopped ()
 Raises an exception if the lifecycle is in "stopped" state.
 DoStart ()
 Start the handler.
 DoStop ()
 Start the handler.
TIdHTTPSession GetSession (TdjServerContext Context, TdjRequest Request, TdjResponse Response, const Boolean Create)
 Get a HTTP session.
 Handle (const string Target, TdjServerContext Context, TdjRequest Request, TdjResponse Response)
 Handles an HTTP request.

Detailed Description

A HandlerWrapper acts as a IHandler but delegates the handle method and life cycle events to a delegate.

This is primarily used to implement the Decorator pattern.

Constructor & Destructor Documentation

◆ TdjHandlerWrapper()

TdjHandlerWrapper::TdjHandlerWrapper ( )

Referenced by GetSession().

Member Function Documentation

◆ AddHandler()

TdjHandlerWrapper::AddHandler ( const IHandler Handler)

Add a handler to the container.

This implementation of AddHandler calls SetHandler with the passed handler. If this HandlerWrapper had a previous wrapped handler, then it is passed to a call to AddHandler on the passed handler.

Parameters
Handlerthe handler to be added

Implements IHandlerContainer.

◆ CheckStarted()

TdjLifeCycle::CheckStarted ( )
protectedinherited

Raises an exception if the lifecycle is in "started" state.

References TdjLifeCycle().

◆ CheckStopped()

TdjLifeCycle::CheckStopped ( )
protectedinherited

Raises an exception if the lifecycle is in "stopped" state.

References TdjLifeCycle(), and Started.

◆ DoStart()

TdjHandlerWrapper::DoStart ( )
protected

Start the handler.

See also
TdjLifeCycle

◆ DoStop()

TdjHandlerWrapper::DoStop ( )
protected

Start the handler.

See also
TdjLifeCycle

◆ GetSession()

TIdHTTPSession TdjHandlerWrapper::GetSession ( TdjServerContext Context,
TdjRequest Request,
TdjResponse Response,
const Boolean Create )
protected

Get a HTTP session.

References TdjHandlerWrapper(), Create(), and Handler.

Referenced by TdjWebComponentContextHandler::AddWebComponent().

◆ Handle()

TdjHandlerWrapper::Handle ( const string Target,
TdjServerContext Context,
TdjRequest Request,
TdjResponse Response )
protected

Handles an HTTP request.

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

Implements IHandler.

◆ IsStarted()

Boolean TdjLifeCycle::IsStarted ( )
inherited
Returns
True if component is started

Implements ILifeCycle.

References Create().

Referenced by DoStart(), and TdjWebComponentHandler::FindHolder().

◆ IsStopped()

Boolean TdjLifeCycle::IsStopped ( )
inherited
Returns
True if component is stopped

Implements ILifeCycle.

Referenced by DoStart().

◆ RemoveHandler()

TdjHandlerWrapper::RemoveHandler ( const IHandler Handler)

Removes a handler from this container.

Parameters
HandlerHandler to remove

Implements IHandlerContainer.

References Handler.

◆ Start()

TdjLifeCycle::Start ( )
inherited

Starts the component.

Implements ILifeCycle.

References Stopped.

◆ Stop()

TdjLifeCycle::Stop ( )
inherited

Stops the component.

Implements ILifeCycle.

References TdjLifeCycle().

Referenced by DoStart(), and TdjWebComponentHandler::InvokeService().

Member Data Documentation

◆ Handler

IHandler TdjHandlerWrapper::Handler

Referenced by GetSession(), and RemoveHandler().

◆ Started

◆ Stopped

Boolean TdjLifeCycle::Stopped
inherited

Referenced by DoStop(), and Start().