using System.Threading; using System.Threading.Tasks; using EmbedIO.Routing; namespace EmbedIO { /// /// Represents a module. /// public interface IWebModule { /// /// Gets the base route of a module. /// /// /// The base route. /// /// /// A base route is either "/" (the root path), /// or a prefix starting and ending with a '/' character. /// string BaseRoute { get; } /// /// Gets a value indicating whether processing of a request should stop /// after a module has handled it. /// /// /// If this property is , a HTTP context's /// method will be automatically called /// immediately after after the returned by /// is completed. This will prevent /// the context from being passed further along to other modules. /// /// /// bool IsFinalHandler { get; } /// /// Gets or sets a callback that is called every time an unhandled exception /// occurs during the processing of a request. /// If this property is (the default), /// the exception will be handled by the web server, or by the containing /// . /// /// ExceptionHandlerCallback? OnUnhandledException { get; set; } /// /// Gets or sets a callback that is called every time a HTTP exception /// is thrown during the processing of a request. /// If this property is (the default), /// the exception will be handled by the web server, or by the containing /// . /// /// HttpExceptionHandlerCallback? OnHttpException { get; set; } /// /// Signals a module that the web server is starting. /// /// A used to stop the web server. void Start(CancellationToken cancellationToken); /// /// Matches the specified URL path against a module's , /// extracting values for the route's parameters and a sub-path. /// /// The URL path to match. /// If the match is successful, a object; /// otherwise, . RouteMatch MatchUrlPath(string urlPath); /// /// Handles a request from a client. /// /// The context of the request being handled. /// A representing the ongoing operation. Task HandleRequestAsync(IHttpContext context); } }