Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Sealed class: RT.Servers.UrlResolver

Summary

Allows you to specify mappings that map URLs to HTTP request handlers.

Remarks

Maintains a collection of UrlMapping objects, making sure that they are always enumerated in a sensible order and ensuring that there are no duplicate hooks added in error. This class is thread-safe except for enumeration; to enumerate the mappings safely, you must hold a lock on the instance until the enumeration is completed.

Constructors

Constructs an empty UrlResolver with no mappings. Use UrlResolver.Add(UrlMapping), UrlResolver.Add(UrlHook, Func<HttpRequest, HttpResponse>, bool) or UrlResolver.AddRange(IEnumerable<UrlMapping>) to add mappings.
UrlResolver(IEnumerable<UrlMapping> mappings)
Initializes this UrlResolver with the specified collection of mappings.
UrlResolver(params UrlMapping[] mappings)

Instance methods

voidAdds the specified mapping to this collection.
void
Add(UrlHook hook, Func<HttpRequest, HttpResponse> handler, bool skippable = false)
void
AddRange(IEnumerable<UrlMapping> items)
Efficiently adds multiple mappings to this collection. Use this method whenever adding multiple mappings at once.
voidRemoves all mappings from this collection.
boolDetermines whether a mapping with the same match specification is present in this collection.
void
CopyTo(UrlMapping[] array, int arrayIndex)
  • Implements: ICollection<UrlMapping>.CopyTo(UrlMapping[], int)
Throws NotImplementedException.
IEnumerator<UrlMapping>
  • Implements: IEnumerable<UrlMapping>.GetEnumerator()
Enumerates the mappings. To maintain thread safety, you must hold a lock on UrlResolver.Locker until the enumeration is finished.
HttpResponse Handles an HTTP request by delegating it to the appropriate handler according to the request’s URL. (see also remarks)
bool Removes a mapping that is equal to the specified mapping. (see also remarks)
int Removes all mappings with a hook equivalent to the specified one.

Instance properties

intGets a value indicating the number of mappings in this collection.
boolReturns false.
objectTake a lock on this object to perform multiple add/remove/clear operations atomically.