|
Daraja HTTP Framework 3.4.0-SNAPSHOT
HTTP server framework for Object Pascal
|
Holds all known web component mappings for a context. More...
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. | |
| Boolean | Normalize (const string Target, string &Normalized) |
| Canonicalizes a request target before routing. | |
Protected Member Functions | |
| Boolean | Matches (const string Path, const string Spec, TSpecType SpecType) |
| Matches a given URL document path against a specified path pattern. | |
Holds all known web component mappings for a context.
Matching is performed in the following order Exact match Longest prefix match Longest suffix match
| TdjPathMap::AddUrlPattern | ( | const string | UrlPattern, |
| TObject | Value ) |
Add a web component mapping.
| UrlPattern | a single component mapping path |
| Value | the mapped web component |
| EDarajaMappingException |
References Matches().
| TdjPathMap::CheckExists | ( | const string | UrlPattern | ) |
Check if a mapping path exists.
This procedure throws a EDarajaMappingException if the URL pattern is already registered for this context.
| UrlPattern | a single component mapping path |
| EDarajaMappingException |
| TStrings TdjPathMap::GetMatches | ( | const string | Path | ) |
Return all matching mappings for the given path.
The best match will be the first entry.
| Path | the URL path (without context |
References GetSpecType(), Matches(), Normalize(), stDefault, stExact, stPrefix, stSuffix, and stUnknown.
| TSpecType TdjPathMap::GetSpecType | ( | const string | Spec | ) |
| Spec | the path specification |
Referenced by GetMatches().
| Boolean TdjPathMap::Matches | ( | const string | Path, |
| const string | Spec ) |
Matches the given path against a specified pattern.
| Path | The file or directory path to be checked. |
| Spec | The pattern or specification to match against. |
|
protected |
Matches a given URL document path against a specified path pattern.
| Path | the URL document path |
| Spec | the path specification |
| SpecType | the path specification type |
Referenced by AddUrlPattern(), and GetMatches().
| Boolean TdjPathMap::Normalize | ( | const string | Target, |
| string & | Normalized ) |
Canonicalizes a request target before routing.
Collapses ., .. and repeated / segments, and strips ;-delimited path parameters from each segment (e.g. /x.jsp;a=b -> /x.jsp), so that a filter and the component it guards – matched separately, but both against the result of this call – are guaranteed to see the same path. .. above the root is absorbed rather than rejected (it cannot escape the leading /). The result never has a trailing / unless it is the root path itself.
| Target | the raw request target (already percent-decoded by Indy) |
| Normalized | the canonicalized path, valid only if this function returns True |
Referenced by GetMatches().