Orckestra CMS allow you to build a RenderingResponseHandler plug-in. It enables developers to intercept
page and media requests and control if the request should be accepted or redirected and if the rendered
resource is allowed to be publicly cached.
Namespace: Composite.Core.WebClient.Renderings.Plugins.RenderingResponseHandlerAssembly: Composite (in Composite.dll) Version: 5.3.6135.33083
Syntax
C# |
---|
public interface IDataRenderingResponseHandler : IRenderingResponseHandler |
Visual Basic |
---|
Public Interface IDataRenderingResponseHandler _ Inherits IRenderingResponseHandler |
Visual C++ |
---|
public interface class IDataRenderingResponseHandler : IRenderingResponseHandler |
Remarks
To create a RenderingResponseHandler plug-in:
- In Visual Studio, create a new "Class Library" project (or use an existing project if you have one).
- Add references to the following assemblies ( Browse and located on your web site):
- /bin/Composite.dll
- /bin/Microsoft.Practices.EnterpriseLibrary.Common.dll
- In each assembly reference's properties, set Copy Local to 'False'.
- Add a reference to System.Configuration (.NET)
- Create a new class for your plug-in (see the source code example below).
- Compile the project and copy the DLL to the website /bin folder.
- Edit the file /App_Data/Composite/Composite.config.
- Locate the element .
- Add a new element inside the <RenderingResponseHandlerPlugins /> element: <add name="Sample" type="TypeName, AssemblyName"/> changing 'Sample' to a name relevant to your project and 'TypeName, AssemblyName' to the fully qualified class name of your plug-in class.
- Restart the C1 site (recycle app pool or use C1 Console; Tools | Restart Server)
Examples
Sample plugin:
CopyC#
Sample configuration snippet from Composite.config:
CopyC#

using System; using Composite.Data; using Composite.Data.Types; using Composite.Core.Logging; using Composite.Core.WebClient.Renderings; using Composite.Core.WebClient.Renderings.Plugins.RenderingResponseHandler; using Microsoft.Practices.EnterpriseLibrary.Common.Configuration; namespace RenderingResponseHandlerSample { [ConfigurationElementType(typeof(NonConfigurableRenderingResponseHandler))] public class RenderingResponseHandlerPluginSample : IDataRenderingResponseHandler { // Have the TCP logger running to see the string being logged - see Composite.Tools.TcpCustomTraceListener // This sample will redirect requests for pages and media containing the word 'secret' in their title / path. public RenderingResponseHandlerResult GetDataResponseHandling(DataEntityToken requestedItemEntityToken) { IData requestedData = requestedItemEntityToken.Data; bool redirect = false; if (requestedData is IPage) { IPage requestedPage = (IPage)requestedData; LoggingService.LogVerbose("Sample", string.Format("Request for page '{0}'.", requestedPage.Title)); if (requestedPage.Title.ToLower().Contains("secret")) { redirect = true; } } else if (requestedData is IMediaFile) { IMediaFile requestedMediaFile = (IMediaFile)requestedData; LoggingService.LogVerbose("Sample", string.Format("Request for media file '{0}'.", requestedMediaFile.CompositePath)); if (requestedMediaFile.CompositePath.ToLower().Contains("secret")) { redirect = true; } } if (redirect) { return new RenderingResponseHandlerResult { PreventPublicCaching = true, RedirectRequesterTo = new Uri("http://docs.composite.net/") }; } else { return new RenderingResponseHandlerResult { PreventPublicCaching = false }; } } } }

<Composite.Core.WebClient.Renderings.Plugins.RenderingResponseHandlerConfiguration> <RenderingResponseHandlerPlugins> <add name="Sample" type="RenderingResponseHandlerSample.RenderingResponseHandlerPluginSample, RenderingResponseHandlerSample" /> </RenderingResponseHandlerPlugins> </Composite.Core.WebClient.Renderings.Plugins.RenderingResponseHandlerConfiguration>