Created
November 10, 2015 15:10
-
-
Save DotTech/1be06fac079a9863a7b8 to your computer and use it in GitHub Desktop.
Pipeline processor with URL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class ProcessorWithUrlBase | |
| { | |
| public string Url { get; set; } | |
| protected bool IsAllowedRequest(HttpRequestArgs args) | |
| { | |
| return string.IsNullOrWhiteSpace(this.Url) || args.Context.Request.RawUrl.StartsWith(this.Url, StringComparison.OrdinalIgnoreCase); | |
| } | |
| } | |
| public class VideoXml : ProcessorWithUrlBase | |
| { | |
| public void Process(HttpRequestArgs args) | |
| { | |
| if (!this.IsAllowedRequest(args)) | |
| { | |
| return; | |
| } | |
| // Do your video.xml thang! | |
| } | |
| } | |
| <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/"> | |
| <sitecore> | |
| <pipelines> | |
| <httpRequestBegin> | |
| <processor type="MyProject.Pipelines.HttpRequestBegin.VideoXml, MyProject" | |
| patch:before="processor[@type='Sitecore.Pipelines.HttpRequest.ItemResolver, Sitecore.Kernel']"> | |
| <url>/video.xml</url> | |
| </processor> | |
| </pipelines> | |
| </sitecore> | |
| </configuration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment