Daraja Framework  1.2
HTTP server framework for Object Pascal
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:

Public Member Functions

 AddHandler (const IHandler Handler)
 Add a handler to the container. More...
 
 RemoveHandler (const IHandler Handler)
 Remove a handler from the container. More...
 
 DoStart ()
 Start the handler.
 
 DoStop ()
 Stop the handler.
 
 Handle (string Target, TdjServerContext Context, TdjRequest Request, TdjResponse Response)
 Handle a HTTP request. More...
 
- Public Member Functions inherited from TdjAbstractHandler
 TdjAbstractHandler ()
 Constructor.
 
 DoStart ()
 Start the handler.
 
 DoStop ()
 Start the handler.
 
 Handle (string Target, TdjServerContext Context, TdjRequest Request, TdjResponse Response)
 Handle a HTTP request. More...
 
- Public Member Functions inherited from TdjLifeCycle
 TdjLifeCycle ()
 Constructor.
 
 Start ()
 Start the handler. More...
 
 Stop ()
 Stop the handler. More...
 
Boolean IsStarted ()
 
Boolean IsStopped ()
 

Public Attributes

IHandler Handler
 
- Public Attributes inherited from TdjLifeCycle
Boolean Started
 True if the state is "started". More...
 
Boolean Stopped
 True if the state is "stopped". More...
 

Protected Member Functions

TIdHTTPSession GetSession (TdjServerContext Context, TdjRequest Request, TdjResponse Response, const Boolean Create)
 Get a HTTP session.
 
- Protected Member Functions inherited from TdjAbstractHandlerContainer
 AddHandler (const IHandler Handler)
 Add a handler. More...
 
 RemoveHandler (const IHandler Handler)
 Remove a handler. More...
 
- Protected Member Functions inherited from TdjLifeCycle
 DoStart ()
 Execute the custom start code.
 
 DoStop ()
 Execute the custom stop code.
 
 CheckStarted ()
 Raises an exception if the lifecycle is in "started" state.
 
 CheckStopped ()
 Raises an exception if the lifecycle is in "stopped" state.
 

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.

Member Function Documentation

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

Referenced by TdjServer::TdjServer(), and TdjWebComponentContextHandler::TdjWebComponentContextHandler().

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

Handle a HTTP request.

Parameters
TargetRequest target
ContextHTTP server context
RequestHTTP request
ResponseHTTP response
Exceptions
EWebComponentExceptionif an exception occurs that interferes with the component's normal operation
See also
IHandler

References Handler.

TdjHandlerWrapper::RemoveHandler ( const IHandler  Handler)

Remove a handler from the container.

Parameters
Handlerthe handler to be removed

Member Data Documentation

IHandler TdjHandlerWrapper::Handler
See also
GetHandler For reading
SetHandler For writing

Referenced by DoStop(), and Handle().