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

Holds a WebComponent and configuration data. More...

Inheritance diagram for TdjWebComponentHolder:
TdjGenericHolder TdjWebComponent TdjLifeCycle ILifeCycle TdjWebComponentHolders

Public Member Functions

 TdjWebComponentHolder (TdjWebComponentClass WebComponentClass)
 Constructor.
 ~TdjWebComponentHolder ()
 Destructor.
IContext GetContext ()
 Get the context.
Boolean IsStarted ()
Boolean IsStopped ()
 SetContext (const IContext Context)
 Set the context.
 SetInitParameter (const string Key, const string Value)
 Set initialization parameter.
 Start ()
 Starts the component.
 Stop ()
 Stops the component.

Public Attributes

Integer LoadOnStartup
 Controls the order in which Web Components are initialized when their context starts, mirroring the Servlet spec's load-on-startup element: components with a lower value are started first.
string Name
Boolean Started
Boolean Stopped
TdjWebComponent WebComponent
 The instance of the Web Component.
TdjWebComponentClass WebComponentClass
 The Web Component Class.

Protected Member Functions

 CheckNotStarted ()
 Raises an exception if the lifecycle is already in "started" state.
 CheckNotStopped ()
 Raises an exception if the lifecycle is already in "stopped" state.

Detailed Description

Holds a WebComponent and configuration data.

Constructor & Destructor Documentation

◆ TdjWebComponentHolder()

TdjWebComponentHolder::TdjWebComponentHolder ( TdjWebComponentClass WebComponentClass)

Constructor.

Parameters
WebComponentClassthe Web Component class

◆ ~TdjWebComponentHolder()

TdjWebComponentHolder::~TdjWebComponentHolder ( )

Destructor.

References WebComponentClass.

Member Function Documentation

◆ CheckNotStarted()

TdjLifeCycle::CheckNotStarted ( )
protectedinherited

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

References Started, and Stopped.

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

◆ CheckNotStopped()

TdjLifeCycle::CheckNotStopped ( )
protectedinherited

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

References TdjLifeCycle().

◆ GetContext()

IContext TdjWebComponentHolder::GetContext ( )

Get the context.

◆ IsStarted()

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

Implements ILifeCycle.

References TdjLifeCycle().

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

◆ IsStopped()

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

Implements ILifeCycle.

References Stopped.

Referenced by DoStop().

◆ SetContext()

TdjWebComponentHolder::SetContext ( const IContext Context)

Set the context.

Parameters
Contextthe context

◆ SetInitParameter()

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

Set initialization parameter.

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

◆ Start()

TdjLifeCycle::Start ( )
inherited

Starts the component.

Implements ILifeCycle.

References TdjLifeCycle().

Referenced by DoStop(), and TdjWebComponentHandler::SetStrictStart().

◆ Stop()

TdjLifeCycle::Stop ( )
inherited

Stops the component.

Note
Unlike Start, a failure in the custom stop code is logged and swallowed rather than re-raised; the component is still marked stopped.

Implements ILifeCycle.

References Started.

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

Member Data Documentation

◆ LoadOnStartup

Integer TdjWebComponentHolder::LoadOnStartup

Controls the order in which Web Components are initialized when their context starts, mirroring the Servlet spec's load-on-startup element: components with a lower value are started first.

Components with the same value (the default, 0) are started in registration order. Has no effect once the holder has already started.

A negative value means the component is not started at context start; instead it is initialized lazily, on the first request that maps to it. Concurrent first requests are safe: only one of them performs the initialization, the others wait for it to finish. If that initialization raises, the request that triggered it receives a 500 response and the holder remains not started, so the next request retries initialization instead of being permanently unavailable.

◆ Name

string TdjGenericHolder::Name
inherited

◆ Started

Boolean TdjLifeCycle::Started
inherited

Referenced by CheckNotStarted(), and Stop().

◆ Stopped

Boolean TdjLifeCycle::Stopped
inherited

Referenced by CheckNotStarted(), and IsStopped().

◆ WebComponent

TdjWebComponent TdjWebComponentHolder::WebComponent

The instance of the Web Component.

◆ WebComponentClass

TdjWebComponentClass TdjWebComponentHolder::WebComponentClass

The Web Component Class.

Referenced by ~TdjWebComponentHolder().