/// <summary> /// Initializes a new instance of the <see cref="TemplateRouteHttpHandler"/> class. /// </summary> /// <param name="responseType">Type of the template response content.</param> /// <param name="realPath">The real server path to map with template request.</param> /// <param name="mode">The file type handling mode.</param> public TemplateRouteHttpHandler(ContentType responseType, string realPath, FileTypeHandlingMode mode) { this.realPath = realPath; this.mode = mode; this.type = responseType; switch (responseType) { case ContentType.Css: this.responseType = "text/css"; break; case ContentType.Js: this.responseType = "text/javascript"; break; } }
/// <summary> /// Initializes a new instance of the <see cref="TemplateRouteHttpHandler"/> class. /// </summary> /// <param name="responseType">Type of the template response content.</param> /// <param name="realPath">The real server path to map with template request.</param> /// <param name="mode">The file type handling mode.</param> public TemplateRouteHttpHandler(string responseType, string realPath, FileTypeHandlingMode mode) { this.responseType = responseType; this.realPath = realPath; this.mode = mode; }
/// <summary> /// Creates the route for template handling. /// </summary> /// <param name="url">The URL pattern for the route.</param> /// <param name="responseType">Type of the templates content response.</param> /// <param name="realPath">The real server path that should be mapped with route pattern.</param> /// <param name="mode">File type(extension) handling mode.</param> /// <returns>Template route handler.</returns> public static Route CreateRoute(string url, ContentType responseType, string realPath, FileTypeHandlingMode mode) { return new Route(url, new TemplateRouteHttpHandler(responseType, realPath, mode)); }