Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Leroy mickleroy

  • Melbourne, Australia
View GitHub Profile
@mickleroy
mickleroy / SlingModelExporter.java
Last active Apr 28, 2017
Simple Sling model showing the use of the Exporter framework
View SlingModelExporter.java
@Model(
adaptables = Resource.class,
resourceType = "acme/components/sling-model"
)
@Exporter(name = "jackson", extensions = "json")
public class MyModel {
@Inject @Named("jcr:title")
private String title;
@mickleroy
mickleroy / CORSFilter.java
Created Feb 4, 2017
Sets Access-Control headers in AEM for Cross Origin Resource Sharing
View CORSFilter.java
package com.github.mickleroy.models;
import org.apache.felix.scr.annotations.sling.SlingFilter;
import org.apache.felix.scr.annotations.sling.SlingFilterScope;
import org.apache.sling.api.SlingHttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.*;
import java.io.IOException;
@mickleroy
mickleroy / we-retail-etc-map-http.json
Last active Dec 26, 2020
We.Retail Sling Mappings (/etc/map/http)
View we-retail-etc-map-http.json
{
"jcr:primaryType": "sling:Folder",
"weretail.com": {
"jcr:primaryType": "sling:Mapping",
"sling:internalRedirect": [
"/content/we-retail/us/en"
],
"weretail_com_content": {
"jcr:primaryType": "sling:Mapping",
@mickleroy
mickleroy / com.day.cq.rewriter.linkchecker.impl.LinkCheckerTransformerFactory.xml
Created Dec 22, 2016
LinkCheckerTransformerFactory configuration for stripping HTML extension
View com.day.cq.rewriter.linkchecker.impl.LinkCheckerTransformerFactory.xml
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="sling:OsgiConfig"
linkcheckertransformer.strictExtensionCheck="{Boolean}false"
linkcheckertransformer.rewriteElements="[a:href,area:href,form:action]"
linkcheckertransformer.disableRewriting="{Boolean}false"
linkcheckertransformer.disableChecking="{Boolean}false"
linkcheckertransformer.stripHtmltExtension="{Boolean}true"
linkcheckertransformer.mapCacheSize="{Long}5000"/>
@mickleroy
mickleroy / org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl.xml
Last active Nov 22, 2019
JcrResourceResolverFactory configuration for We.Retail
View org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl.xml
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="sling:OsgiConfig"
resource.resolver.searchpath="[/apps,/libs,/apps/foundation/components/primary,/libs/foundation/components/primary]"
resource.resolver.manglenamespaces="{Boolean}true"
resource.resolver.allowDirect="{Boolean}true"
resource.resolver.required.providers="[org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProviderFactory]"
resource.resolver.virtual="[/:/]"
resource.resolver.mapping="[/-/,/content/we-retail/us/en/-/]"
resource.resolver.map.location="/etc/map"