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

Context handler. More...

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

Public Member Functions

 TdjContextHandler (const string ContextPath)
 Create a ContextHandler.
 ~TdjContextHandler ()
 Destructor.
 AddHandler (const IHandler Handler)
 Add a handler to the container.
string GetContextPath ()
IContext GetCurrentContext ()
 The internal IContext field.
IHandler GetHandler ()
Boolean IsStarted ()
Boolean IsStopped ()
 RemoveHandler (const IHandler Handler)
 Removes a handler from this container.
 SetErrorHandler (const IHandler Value)
 SetHandler (const IHandler Value)
 SetInitParameter (const string Key, const string Value)
 Set initialization parameter.
 SetStarted (const Boolean Value)
 SetStopped (const Boolean Value)
 Start ()
 Starts the component.
 Stop ()
 Stops the component.

Public Attributes

TStrings ConnectorNames
string ContextPath
TCriticalSection CS
IHandler ErrorHandler
TStrings FConnectorNames
IContext FContext
IHandler FErrorHandler
IHandler FHandler
Boolean FStopped
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.
Boolean ContextMatches (const string ConnectorName, const string Target)
 Check if the Document matches this context.
 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.
string ToConnectorName (TdjServerContext Context)
 Creates connector name in the form 'host:port'.

Detailed Description

Context handler.

Constructor & Destructor Documentation

◆ TdjContextHandler()

TdjContextHandler::TdjContextHandler ( const string ContextPath)

Create a ContextHandler.

◆ ~TdjContextHandler()

TdjContextHandler::~TdjContextHandler ( )

Destructor.

Member Function Documentation

◆ AddHandler()

TdjHandlerWrapper::AddHandler ( const IHandler Handler)
inherited

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.

◆ CheckStopped()

TdjLifeCycle::CheckStopped ( )
protectedinherited

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

References TdjLifeCycle().

◆ ContextMatches()

Boolean TdjContextHandler::ContextMatches ( const string ConnectorName,
const string Target )
protected

Check if the Document matches this context.

Parameters
ConnectorNamethe connector name (like 'host:port'
Targetthe target URL document
Returns
True if the context matches the connector name and target URL document

Referenced by TdjWebComponentContextHandler::Add().

◆ DoStart()

TdjContextHandler::DoStart ( )
protected

Start the handler.

See also
TdjLifeCycle

◆ DoStop()

TdjContextHandler::DoStop ( )
protected

Start the handler.

See also
TdjLifeCycle

◆ GetContextPath()

string TdjContextHandler::GetContextPath ( )

◆ GetCurrentContext()

IContext TdjContextHandler::GetCurrentContext ( )

The internal IContext field.

◆ GetHandler()

IHandler TdjHandlerWrapper::GetHandler ( )
inherited

References Handler, and SetHandler().

◆ GetSession()

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

Get a HTTP session.

References TdjHandlerWrapper(), FHandler, Handler, and SetHandler().

Referenced by TdjWebComponentContextHandler::Add().

◆ Handle()

TdjContextHandler::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 TdjLifeCycle().

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

◆ IsStopped()

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

Implements ILifeCycle.

References Create().

Referenced by DoStart().

◆ RemoveHandler()

TdjHandlerWrapper::RemoveHandler ( const IHandler Handler)
inherited

Removes a handler from this container.

Parameters
HandlerHandler to remove

Implements IHandlerContainer.

◆ SetErrorHandler()

TdjContextHandler::SetErrorHandler ( const IHandler Value)

◆ SetHandler()

TdjHandlerWrapper::SetHandler ( const IHandler Value)
inherited

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

Referenced by GetHandler(), and GetSession().

◆ SetInitParameter()

TdjContextHandler::SetInitParameter ( const string Key,
const string Value )

Set initialization parameter.

Parameters
Keyinit parameter name
Valueinit parameter value

◆ SetStarted()

TdjLifeCycle::SetStarted ( const Boolean Value)
inherited

Referenced by DoStop().

◆ SetStopped()

TdjLifeCycle::SetStopped ( const Boolean Value)
inherited

Referenced by DoStop().

◆ Start()

TdjLifeCycle::Start ( )
inherited

Starts the component.

Implements ILifeCycle.

References TdjLifeCycle().

Referenced by DoStart().

◆ Stop()

TdjLifeCycle::Stop ( )
inherited

Stops the component.

Implements ILifeCycle.

References Stopped.

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

◆ ToConnectorName()

string TdjContextHandler::ToConnectorName ( TdjServerContext Context)
protected

Creates connector name in the form 'host:port'.

Returns
connector name

Referenced by TdjWebComponentContextHandler::Add().

Member Data Documentation

◆ ConnectorNames

TStrings TdjContextHandler::ConnectorNames

◆ ContextPath

string TdjContextHandler::ContextPath

◆ CS

TCriticalSection TdjLifeCycle::CS
inherited

Referenced by ~TdjLifeCycle().

◆ ErrorHandler

IHandler TdjContextHandler::ErrorHandler

◆ FConnectorNames

TStrings TdjContextHandler::FConnectorNames

◆ FContext

IContext TdjContextHandler::FContext

◆ FErrorHandler

IHandler TdjContextHandler::FErrorHandler

◆ FHandler

IHandler TdjHandlerWrapper::FHandler
inherited

Referenced by GetSession().

◆ FStopped

Boolean TdjLifeCycle::FStopped
inherited

Referenced by ~TdjLifeCycle(), and DoStop().

◆ Handler

IHandler TdjHandlerWrapper::Handler
inherited

Referenced by GetHandler(), GetSession(), and SetHandler().

◆ Started

Boolean TdjLifeCycle::Started
inherited

◆ Stopped

Boolean TdjLifeCycle::Stopped
inherited

Referenced by DoStop(), and Stop().