Daraja Framework
1.2
HTTP server framework for Object Pascal
|
Web Component handler. More...
Public Member Functions | |
TdjWebComponentHandler () | |
Create a ContextHandler. More... | |
~TdjWebComponentHandler () | |
Destructor. | |
AddMapping (const TdjWebComponentMapping Mapping) | |
Add a mapping. | |
AddWithMapping (const TdjWebComponentHolder Holder, const string PathSpec) | |
Add a Web Component holder with mapping. More... | |
TdjWebComponentHolder | CreateHolder (const TdjWebComponentClass WebComponentClass) |
Create a TdjWebComponentHolder for a WebComponentClass. More... | |
TdjWebComponentHolder | FindHolder (const TdjWebComponentClass WebComponentClass) |
Find a TdjWebComponentHolder for a WebComponentClass. More... | |
Handle (string Target, TdjServerContext Context, TdjRequest Request, TdjResponse Response) | |
Handle a HTTP request. More... | |
DoStart () | |
Start the handler. | |
DoStop () | |
Stop the handler. | |
![]() | |
TdjAbstractHandler () | |
Constructor. | |
DoStart () | |
Start the handler. | |
DoStop () | |
Start the handler. | |
Handle (string Target, TdjServerContext Context, TdjRequest Request, TdjResponse Response) | |
Handle a HTTP request. More... | |
![]() | |
TdjLifeCycle () | |
Constructor. | |
Start () | |
Start the handler. More... | |
Stop () | |
Stop the handler. More... | |
Boolean | IsStarted () |
Boolean | IsStopped () |
Public Attributes | |
IContext | WebComponentContext |
TdjWebComponentMappings | WebComponentMappings |
TdjWebComponentHolders | WebComponents |
![]() | |
Boolean | Started |
True if the state is "started". More... | |
Boolean | Stopped |
True if the state is "stopped". More... | |
Protected Member Functions | |
TdjWebComponentHolder | FindComponent (const string ATarget) |
Find matching component. More... | |
![]() | |
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. | |
Web Component handler.
An instance of this class is created per context.
It holds a list of web components and their path mappings, and passes incoming requests to the matching web component.
TdjWebComponentHandler::TdjWebComponentHandler | ( | ) |
Create a ContextHandler.
Use a ContextConfig (required argument) to configure the route mappings.
References AddMapping(), TdjPathMap::AddPathSpec(), AddWithMapping(), TdjPathMap::CheckExists(), CreateHolder(), DoStart(), DoStop(), FindComponent(), FindHolder(), TdjWebComponentHolder::GetContext(), TdjPathMap::GetMatches(), TdjPathMap::GetSpecType(), Handle(), TdjLifeCycle::IsStarted(), TdjGenericHolder::Name, TdjWebComponent::Service(), TdjLifeCycle::Start(), TdjLifeCycle::Started, TdjLifeCycle::Stop(), TdjWebComponentHolder::WebComponent, WebComponentContext, WebComponentMappings, TdjWebComponentMapping::WebComponentName, WebComponents, and ~TdjWebComponentHandler().
TdjWebComponentHandler::AddWithMapping | ( | const TdjWebComponentHolder | Holder, |
const string | PathSpec | ||
) |
Add a Web Component holder with mapping.
Holder | a Web Component holder |
PathSpec | a path spec |
Referenced by TdjWebComponentContextHandler::Add(), TdjWebComponentContextHandler::AddWebComponent(), and TdjWebComponentHandler().
TdjWebComponentHolder TdjWebComponentHandler::CreateHolder | ( | const TdjWebComponentClass | WebComponentClass | ) |
Create a TdjWebComponentHolder for a WebComponentClass.
WebComponentClass | the Web Component class |
Referenced by TdjWebComponentHandler().
|
protected |
Find matching component.
ATarget | the URL document path. |
Referenced by TdjWebComponentHandler().
TdjWebComponentHolder TdjWebComponentHandler::FindHolder | ( | const TdjWebComponentClass | WebComponentClass | ) |
Find a TdjWebComponentHolder for a WebComponentClass.
WebComponentClass | the Web Component class |
Referenced by TdjWebComponentContextHandler::Add(), and TdjWebComponentHandler().
TdjWebComponentHandler::Handle | ( | string | Target, |
TdjServerContext | Context, | ||
TdjRequest | Request, | ||
TdjResponse | Response | ||
) |
Handle a HTTP request.
Target | Request target |
Context | HTTP server context |
Request | HTTP request |
Response | HTTP response |
EWebComponentException | if an exception occurs that interferes with the component's normal operation |
Referenced by TdjWebComponentContextHandler::DoHandle(), and TdjWebComponentHandler().
IContext TdjWebComponentHandler::WebComponentContext |
Referenced by TdjWebComponentHandler().
TdjWebComponentMappings TdjWebComponentHandler::WebComponentMappings |
Referenced by TdjWebComponentHandler().
TdjWebComponentHolders TdjWebComponentHandler::WebComponents |
Referenced by TdjWebComponentHandler().