Skip to content

Instantly share code, notes, and snippets.

@DotTech
Created November 10, 2015 15:10
Show Gist options
  • Select an option

  • Save DotTech/1be06fac079a9863a7b8 to your computer and use it in GitHub Desktop.

Select an option

Save DotTech/1be06fac079a9863a7b8 to your computer and use it in GitHub Desktop.
Pipeline processor with URL
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