Daraja Framework  1.2
HTTP server framework for Object Pascal
TdjPathMap Class Reference

Holds all known web component mappings for a context. More...

+ Inheritance diagram for TdjPathMap:

Public Member Functions

TSpecType GetSpecType (const string Spec)
 
 CheckExists (const string PathSpec)
 Check if a mapping path exists. More...
 
 AddPathSpec (const string PathSpec, TObject Value)
 Add a web component mapping. More...
 
TStrings GetMatches (const string Path)
 Return all matching mappings for the given path. More...
 

Protected Member Functions

Boolean Matches (const string Path, const string Spec, const TSpecType SpecType)
 

Detailed Description

Holds all known web component mappings for a context.

Matching is performed in the following order Exact match Longest prefix match Longest suffix match

Member Function Documentation

TdjPathMap::AddPathSpec ( const string  PathSpec,
TObject  Value 
)

Add a web component mapping.

Parameters
PathSpeca single component mapping path (for example, '*.html' or '/*')
Valuethe mapped web component
Exceptions
EWebComponentException

References CheckExists().

Referenced by TdjWebComponentHandler::TdjWebComponentHandler().

TdjPathMap::CheckExists ( const string  PathSpec)

Check if a mapping path exists.

This procedure throws a EWebComponentException if the PathSpec is already registered for this context.

Parameters
PathSpeca single component mapping path (for example, '*.html' or '/*')
Exceptions
EWebComponentException

Referenced by AddPathSpec(), and TdjWebComponentHandler::TdjWebComponentHandler().

TStrings TdjPathMap::GetMatches ( const string  Path)

Return all matching mappings for the given path.

The best match will be the first entry.

Parameters
Paththe URL path (without context), for example 'test.html'
Returns
list of matching mappings

References GetSpecType(), and Matches().

Referenced by TdjWebComponentHandler::TdjWebComponentHandler().

class TSpecType TdjPathMap::GetSpecType ( const string  Spec)
Parameters
Specthe path specification (for example, '/*')
Returns
the path specification type

Referenced by GetMatches(), and TdjWebComponentHandler::TdjWebComponentHandler().

class Boolean TdjPathMap::Matches ( const string  Path,
const string  Spec,
const TSpecType  SpecType 
)
protected
Parameters
Paththe URL document path
Specthe path specification (for example, '/*')
SpecTypethe path specification type
Returns
True if the Path mathes the Spec (with known SpecType)

Referenced by GetMatches().