Summary
Encapsulates a mapping from URLs to a request handler. Add instances of this class to a
UrlResolver
to map URL paths or domains to request handlers. This class is immutable.
Constructors
|
Initialises a new UrlMapping. |
UrlMapping(Func<HttpRequest, HttpResponse> handler, string domain = null, int? port = null, string path = null, bool specificDomain = false, bool specificPath = false, bool skippable = false) |
Instance methods
int | |
Compares this mapping to another one, and returns a value indicating which mapping should be checked for a
match first. The ordering is such that more specific mappings are checked first, so that they trigger even if
a more generic mapping encompasses the specific one. Hence skippable mappings are treated exactly the same,
and are only reordered with respect to the single non-skippable mapping that matches the exact same request. |
bool | |
Compares mappings for equality. Two mappings are equal if UrlMapping.Hook and UrlMapping.Skippable are
equal; UrlMapping.Handler is ignored. |
bool | |
int | |
Computes a hash code suitable as a heuristic for the kind of equality defined by UrlMapping.Equals(object). |
string | | Returns a debugging-friendly representation of this hook's match specification. |
Instance properties
Func<HttpRequest, HttpResponse> | | Gets the request handler for this mapping. |
UrlHook | | Gets the hook that determines which URLs can trigger the UrlMapping.Handler. |
bool | |
Gets a value indicating whether the UrlMapping.Handler may return null , in which case it will be
skipped and another applicable handler executed instead. Skippable handlers may have a hook identical to that
of other handlers. |