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

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

Inheritance diagram for TdjPathMap:

Public Member Functions

 AddUrlPattern (const string UrlPattern, TObject Value)
 Add a web component mapping.
 CheckExists (const string UrlPattern)
 Check if a mapping path exists.
TStrings GetMatches (const string Path)
 Return all matching mappings for the given path.
TSpecType GetSpecType (const string Spec)
Boolean Matches (const string Path, const string Spec)
 Matches the given path against a specified pattern.

Protected Member Functions

Boolean Matches (const string Path, const string Spec, TSpecType SpecType)
 Matches a given URL document path against a specified path pattern.

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

◆ AddUrlPattern()

TdjPathMap::AddUrlPattern ( const string UrlPattern,
TObject Value )

Add a web component mapping.

Parameters
UrlPatterna single component mapping path
Valuethe mapped web component
Exceptions
EWebComponentException

References Matches().

◆ CheckExists()

TdjPathMap::CheckExists ( const string UrlPattern)

Check if a mapping path exists.

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

Parameters
UrlPatterna single component mapping path
Exceptions
EWebComponentException

◆ GetMatches()

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
Returns
list of matching mappings

References Create(), GetMatches(), GetSpecType(), Matches(), stDefault, stExact, stPrefix, stSuffix, and stUnknown.

Referenced by GetMatches().

◆ GetSpecType()

TSpecType TdjPathMap::GetSpecType ( const string Spec)
Parameters
Specthe path specification
Returns
the path specification type

Referenced by GetMatches().

◆ Matches() [1/2]

Boolean TdjPathMap::Matches ( const string Path,
const string Spec )

Matches the given path against a specified pattern.

Parameters
PathThe file or directory path to be checked.
SpecThe pattern or specification to match against.
Returns
True if the path matches the specification, otherwise False.

◆ Matches() [2/2]

Boolean TdjPathMap::Matches ( const string Path,
const string Spec,
TSpecType SpecType )
protected

Matches a given URL document path against a specified path pattern.

Parameters
Paththe URL document path
Specthe path specification
SpecTypethe path specification type
Returns
True if the Path matches the Spec (with known SpecType)

Referenced by AddUrlPattern(), and GetMatches().