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

Context Handler for Web Components (and Web Filters). More...

Inheritance diagram for TdjWebComponentContextHandler:
TdjContextHandler TdjHandlerWrapper TdjAbstractHandlerContainer TdjWebAppContext

Public Member Functions

 TdjWebComponentContextHandler (const string ContextPath, Boolean Sessions=False)
 Constructor.
 ~TdjWebComponentContextHandler ()
 Destructor.
TdjWebComponentHolder Add (TdjWebComponentClass ComponentClass, const string UrlPattern)
 Add a Web Component.
TdjWebFilterHolder Add (TdjWebFilterClass FilterClass, const string UrlPattern)
 Add a Web Filter, specifying a WebFilter class.
 AddHandler (const IHandler Handler)
 Add a handler to the container.
TdjWebComponentHolder AddWebComponent (TdjWebComponentClass ComponentClass, const string UrlPattern)
 Add a Web Component.
TdjWebFilterHolder AddWebFilter (TdjWebFilterClass FilterClass, const string UrlPattern)
 Add a Web Filter, specifying a WebFilter class.
IContext GetCurrentContext ()
 The internal IContext field.
 RemoveHandler (const IHandler Handler)
 SetInitParameter (const string Key, const string Value)
 Set initialization parameter.

Public Attributes

TStrings ConnectorNames
string ContextPath
IHandler ErrorHandler
IHandler Handler

Protected Member Functions

Boolean ContextMatches (const string ConnectorName, const string Target)
 Check if the Document matches this context.
 DoHandle (const string Target, TdjServerContext Context, TdjRequest Request, TdjResponse Response)
 DoStart ()
 Start the handler.
 DoStop ()
 Stop 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)
string ToConnectorName (TdjServerContext Context)
 Creates connector name in the form 'host:port'.

Detailed Description

Context Handler for Web Components (and Web Filters).

Constructor & Destructor Documentation

◆ TdjWebComponentContextHandler()

TdjWebComponentContextHandler::TdjWebComponentContextHandler ( const string ContextPath,
Boolean Sessions = False )

Constructor.

Parameters
ContextPaththe context path
Sessionsenable HTTP sessions

References Add().

Referenced by Add().

◆ ~TdjWebComponentContextHandler()

TdjWebComponentContextHandler::~TdjWebComponentContextHandler ( )

Destructor.

Member Function Documentation

◆ Add() [1/2]

TdjWebComponentHolder TdjWebComponentContextHandler::Add ( TdjWebComponentClass ComponentClass,
const string UrlPattern )

Add a Web Component.

Parameters
ComponentClassWebComponent class
UrlPatternpath specification
Returns
the Web Component holder, which can be used for further configuration.
Exceptions
EWebComponentExceptionif the Web Component can not be added

References TdjWebComponentContextHandler().

Referenced by TdjWebComponentContextHandler(), and DoHandle().

◆ Add() [2/2]

TdjWebFilterHolder TdjWebComponentContextHandler::Add ( TdjWebFilterClass FilterClass,
const string UrlPattern )

Add a Web Filter, specifying a WebFilter class.

Parameters
FilterClassWebFilter class
UrlPatternpath specification
Returns
the Web Filter holder, which can be used for further configuration.
Exceptions
Exceptionif the WebFilter can not be added

◆ 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

Referenced by TdjWebComponentContextHandler::AddWebFilter(), TdjServer::GetConnector(), and GetSession().

◆ AddWebComponent()

TdjWebComponentHolder TdjWebComponentContextHandler::AddWebComponent ( TdjWebComponentClass ComponentClass,
const string UrlPattern )

Add a Web Component.

Ownership: the returned holder belongs to the context. Use it only for further configuration (init parameters etc.); do not free it or keep it past the lifetime of the context.

Parameters
ComponentClassWebComponent class
UrlPatternpath specification
Returns
the Web Component holder, which can be used for further configuration.
Exceptions
EWebComponentExceptionif the Web Component can not be added

◆ AddWebFilter()

TdjWebFilterHolder TdjWebComponentContextHandler::AddWebFilter ( TdjWebFilterClass FilterClass,
const string UrlPattern )

Add a Web Filter, specifying a WebFilter class.

Ownership: the returned holder belongs to the context. Use it only for further configuration; do not free it or keep it past the lifetime of the context. If the filter cannot be added the holder is freed before the exception propagates.

Parameters
FilterClassWebFilter class
UrlPatternpath specification
Returns
the Web Filter holder, which can be used for further configuration.
Exceptions
Exceptionif the WebFilter can not be added

References TdjHandlerWrapper::AddHandler().

◆ ContextMatches()

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

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

◆ DoHandle()

TdjWebComponentContextHandler::DoHandle ( const string Target,
TdjServerContext Context,
TdjRequest Request,
TdjResponse Response )
protected
Parameters
TargetRequest target
ContextHTTP server context
RequestHTTP request
ResponseHTTP response

References Add().

◆ DoStart()

TdjContextHandler::DoStart ( )
protectedinherited

Start the handler.

See also
TdjLifeCycle

◆ DoStop()

TdjContextHandler::DoStop ( )
protectedinherited

Stop the handler.

See also
TdjLifeCycle

◆ GetCurrentContext()

IContext TdjContextHandler::GetCurrentContext ( )
inherited

The internal IContext field.

◆ GetSession()

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

Get a HTTP session.

References AddHandler(), and Handler.

◆ Handle()

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

◆ RemoveHandler()

TdjHandlerWrapper::RemoveHandler ( const IHandler Handler)
inherited

◆ SetInitParameter()

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

Set initialization parameter.

Parameters
Keyinit parameter name (case-sensitive)
Valueinit parameter value
Exceptions
EWebComponentExceptionif the key is already set

◆ ToConnectorName()

string TdjContextHandler::ToConnectorName ( TdjServerContext Context)
protectedinherited

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

Returns
connector name

Member Data Documentation

◆ ConnectorNames

TStrings TdjContextHandler::ConnectorNames
inherited

◆ ContextPath

string TdjContextHandler::ContextPath
inherited

◆ ErrorHandler

IHandler TdjContextHandler::ErrorHandler
inherited

◆ Handler

IHandler TdjHandlerWrapper::Handler
inherited