Core - FolderSchemeHandlerFactory add protected virtual Create method

override Create to implement custom behaviour
This commit is contained in:
amaitland
2020-04-05 05:33:22 +10:00
parent 3d3c1c203c
commit 0592d69784
@@ -68,11 +68,30 @@ namespace CefSharp.SchemeHandler
/// A IResourceHandler
/// </returns>
IResourceHandler ISchemeHandlerFactory.Create(IBrowser browser, IFrame frame, string schemeName, IRequest request)
{
return Create(browser, frame, schemeName, request);
}
/// <summary>
/// If the file requested is within the rootFolder then a IResourceHandler reference to the file requested will be returned
/// otherwise a 404 ResourceHandler will be returned.
/// </summary>
/// <param name="browser">the browser window that originated the
/// request or null if the request did not originate from a browser window
/// (for example, if the request came from CefURLRequest).</param>
/// <param name="frame">frame that originated the request
/// or null if the request did not originate from a browser window
/// (for example, if the request came from CefURLRequest).</param>
/// <param name="schemeName">the scheme name</param>
/// <param name="request">The request. (will not contain cookie data)</param>
/// <returns>
/// A IResourceHandler
/// </returns>
protected virtual IResourceHandler Create(IBrowser browser, IFrame frame, string schemeName, IRequest request)
{
if (this.schemeName != null && !schemeName.Equals(this.schemeName, StringComparison.OrdinalIgnoreCase))
{
return ResourceHandler.ForErrorMessage(string.Format("SchemeName {0} does not match the expected SchemeName of {1}.", schemeName, this.schemeName), HttpStatusCode.NotFound);
}
var uri = new Uri(request.Url);