using System; using System.Threading.Tasks; using System.Net; using System.Dynamic; namespace GalleryShare.RequestRouter { public interface IRequestRoute { /// /// The priority of the request route. /// Higher priority routes will always be chosen to handle requests over lower priority ones. /// Note that only 1 route may handle any given request. /// int Priority { get; } void SetParentServer(GalleryServer inGalleryServer); /// /// Works out whether the request route hander can handle a request to the given path. /// /// The path to check to see if it can be handled. /// Whether the request route can handle a request to the given path. bool CanHandle(string rawUrl, string requestedPath); /// /// Handles a HTTP request asynchronously. /// Note that the master request router will close the request for you, so you don't need to bother. /// /// The Http request to handle. /// The transformed url path of the given request. Task HandleRequestAsync(HttpListenerContext cycle, string requestedPath); } }