This file contains 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
using Newtonsoft.Json.Linq; | |
using Sitecore.Data; | |
using Sitecore.Data.Items; | |
using Sitecore.Diagnostics; | |
using Sitecore.Globalization; | |
using Sitecore.LayoutService.Configuration; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace JSSDemo.Feature.Blog.Extensions |
This file contains 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
using Newtonsoft.Json.Linq; | |
using Sitecore.Data; | |
using Sitecore.Data.Items; | |
using Sitecore.Diagnostics; | |
using Sitecore.LayoutService.Configuration; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace JSSDemo.Feature.Blog.Extensions | |
{ |
This file contains 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
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> | |
<sitecore> | |
<pipelines> | |
<group groupName="layoutService"> | |
<pipelines> | |
<getLayoutServiceContext> | |
<processor type="JSSDemo.Feature.Metadata.PipelineProcessors.ItemContext, JSSDemo.Feature.Metadata" /> | |
</getLayoutServiceContext> | |
</pipelines> | |
</group> |
This file contains 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
using Sitecore.Diagnostics; | |
using Sitecore.LayoutService.ItemRendering.Pipelines.GetLayoutServiceContext; | |
using System.Collections.Generic; | |
using Sitecore; | |
using Sitecore.Links; | |
namespace JSSDemo.Feature.Metadata.PipelineProcessors | |
{ | |
public class ItemContext : IGetLayoutServiceContextProcessor | |
{ |
This file contains 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
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> | |
<sitecore> | |
<pipelines> | |
<group groupName="layoutService"> | |
<!-- NOTE: This patch will be have a slightly different signature in Headless Services for Sitecore 9.x vs 10. The below works for Headless Services in Sitecore 10 --> | |
<pipelines> | |
<renderJsonRendering> | |
<processor type="JSSDemo.Foundation.LayoutService.PipelineProcessors.CustomInitialize, JSSDemo.Foundation.LayoutService" resolve="true" | |
patch:instead="*[@type='Sitecore.LayoutService.Presentation.Pipelines.RenderJsonRendering.Initialize, Sitecore.LayoutService']"/> | |
</renderJsonRendering> |
This file contains 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
using System.Collections.Generic; | |
using Sitecore.Data; | |
using Sitecore.Data.Items; | |
using Sitecore.LayoutService.Configuration; | |
using Sitecore.LayoutService.ItemRendering; | |
using Sitecore.LayoutService.Presentation.Pipelines.RenderJsonRendering; | |
using Sitecore.LayoutService.Serialization; | |
using Sitecore.Mvc.Presentation; | |
using System.Linq; |
This file contains 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
HttpResponseBase response = filterContext.HttpContext.Response; | |
response.Headers["Access-Control-Allow-Origin"] = header; | |
if (string.IsNullOrWhiteSpace(response.Headers.Get("Access-Control-Allow-Headers"))) | |
response.AddHeader("Access-Control-Allow-Headers", "*"); | |
if (string.IsNullOrWhiteSpace(response.Headers.Get("Access-Control-Allow-Credentials"))) | |
response.AddHeader("Access-Control-Allow-Credentials", "true"); | |
if (string.IsNullOrWhiteSpace(response.Headers.Get("Access-Control-Allow-Credentials"))) | |
response.AddHeader("Access-Control-Expose-Headers", "ETag"); | |
if (!string.IsNullOrWhiteSpace(response.Headers.Get("Access-Control-Max-Age"))) | |
return; |
This file contains 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
<?xml version="1.0"?> | |
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/"> | |
<sitecore> | |
<pipelines> | |
<mvc.requestBegin> | |
<processor type="Mysite.Feature.Redirects.Pipelines.RedirectHandler, Mysite.Feature.Redirects" resolve="true" | |
patch:after="*[@type='Sitecore.LayoutService.Mvc.Pipelines.RequestBegin.ContextItemResolver, Sitecore.LayoutService.Mvc']"/> | |
</mvc.requestBegin> | |
</pipelines> | |
</sitecore> |