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

Basic server class for the Web Component framework. More...

Inheritance diagram for TdjServer:
TdjServerBase TdjHandlerWrapper IHandlerContainer TdjAbstractHandlerContainer TdjAbstractHandler IHandlerContainer TdjLifeCycle IHandler ILifeCycle

Public Member Functions

 TdjServer ()
 Create a TdjServer using the default host and port.
 TdjServer (const Integer APort)
 Create a TdjServer, using the specified port and the default host.
 TdjServer (const string AHost, const Integer APort=DEFAULT_BINDING_PORT)
 Create a TdjServer, using the specfied host and port.
 ~TdjServer ()
 Destructor.
 Add (TdjWebComponentContextHandler Context)
 Add a new context.
 AddConnector (const IConnector Connector)
 Add a preconfigured connector.
 AddConnector (const string Host, Integer Port=DEFAULT_BINDING_PORT)
 Create and add a connector for a host and port.
 AddHandler (const IHandler Handler)
 Add a handler to the container.
Integer ConnectorCount ()
 The number of connectors.
IHandler GetHandler ()
Boolean IsStarted ()
Boolean IsStopped ()
 RemoveHandler (const IHandler Handler)
 Removes a handler from this container.
 SetHandler (const IHandler Value)
 SetStarted (const Boolean Value)
 SetStopped (const Boolean Value)
 Start ()
 Starts the component.
 StartConnectors ()
 Stop ()
 Stops the component.
 StopConnectors ()
 StopContextHandlers ()

Public Attributes

< > TdjStrings ConnectorList
IHandlerContainer ContextHandlers
TStrings ContextNames
TCriticalSection CS
string FDefaultHost
Integer FDefaultPort
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.
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.

Detailed Description

Basic server class for the Web Component framework.

Constructor & Destructor Documentation

◆ TdjServer() [1/3]

TdjServer::TdjServer ( )

Create a TdjServer using the default host and port.

References Add().

Referenced by StartConnectors(), and StopContextHandlers().

◆ TdjServer() [2/3]

TdjServer::TdjServer ( const Integer APort)

Create a TdjServer, using the specified port and the default host.

Parameters
APortthe port to be used.

◆ TdjServer() [3/3]

TdjServer::TdjServer ( const string AHost,
const Integer APort = DEFAULT_BINDING_PORT )

Create a TdjServer, using the specfied host and port.

Parameters
AHostthe host to be used.
APortthe port to be used.

◆ ~TdjServer()

TdjServer::~TdjServer ( )

Destructor.

Member Function Documentation

◆ Add()

TdjServer::Add ( TdjWebComponentContextHandler Context)

Add a new context.

Parameters
Contextthe context handler.
Exceptions
EWebComponentExceptionif an error occurs that interferes with the component's normal operation.

Referenced by TdjServer(), and ConnectorCount().

◆ AddConnector() [1/2]

TdjServer::AddConnector ( const IConnector Connector)

Add a preconfigured connector.

Parameters
Connectorthe connector

◆ AddConnector() [2/2]

TdjServer::AddConnector ( const string Host,
Integer Port = DEFAULT_BINDING_PORT )

Create and add a connector for a host and port.

Parameters
Hostthe connector host name
Portthe connector port number

◆ 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().

◆ ConnectorCount()

Integer TdjServer::ConnectorCount ( )

The number of connectors.

Returns
number of connectors

References Add().

◆ 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()

TdjServerBase::Handle ( const string Target,
TdjServerContext Context,
TdjRequest Request,
TdjResponse Response )
protectedinherited

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.

◆ SetHandler()

TdjHandlerWrapper::SetHandler ( const IHandler Value)
inherited

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

Referenced by GetHandler(), and GetSession().

◆ 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().

◆ StartConnectors()

TdjServer::StartConnectors ( )

References TdjServer(), and Create().

◆ Stop()

TdjLifeCycle::Stop ( )
inherited

Stops the component.

Implements ILifeCycle.

References Stopped.

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

◆ StopConnectors()

TdjServer::StopConnectors ( )

◆ StopContextHandlers()

TdjServer::StopContextHandlers ( )

References TdjServer(), and Create().

Member Data Documentation

◆ ConnectorList

< > TdjStrings TdjServer::ConnectorList

◆ ContextHandlers

IHandlerContainer TdjServer::ContextHandlers

◆ ContextNames

TStrings TdjServer::ContextNames

◆ CS

TCriticalSection TdjLifeCycle::CS
inherited

Referenced by ~TdjLifeCycle().

◆ FDefaultHost

string TdjServer::FDefaultHost

◆ FDefaultPort

Integer TdjServer::FDefaultPort

◆ 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().