This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag 
org.apache.sling.scripting.thymeleaf-0.0.6
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git

commit 571c1020bf9501b4d844d18b5c54127cff6b920d
Author: Oliver Lietz <[email protected]>
AuthorDate: Mon Jan 12 18:24:27 2015 +0000

    SLING-4297 add a dialect and processors to provide out-of-the-box support 
for a Sling Include
    
    * new Sling dialect
    * include with support for resource and path
        (resourceType, replaceSelectors, addSelectors and replaceSuffix request 
dispatcher options
        and unwrap to remove host tag)
    
    git-svn-id: 
https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/thymeleaf@1651157
 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            |   6 +
 .../thymeleaf/internal/dialect/SlingDialect.java   |  74 ++++++++++
 .../scripting/thymeleaf/internal/dom/NodeUtil.java |  34 +++++
 .../attr/SlingAddSelectorsAttrProcessor.java       |  43 ++++++
 .../processor/attr/SlingIncludeAttrProcessor.java  | 163 +++++++++++++++++++++
 .../attr/SlingNodePropertyAttrProcessor.java       |  52 +++++++
 .../processor/attr/SlingPathAttrProcessor.java     |  43 ++++++
 .../attr/SlingReplaceSelectorsAttrProcessor.java   |  43 ++++++
 .../attr/SlingReplaceSuffixAttrProcessor.java      |  43 ++++++
 .../processor/attr/SlingResourceAttrProcessor.java |  43 ++++++
 .../attr/SlingResourceTypeAttrProcessor.java       |  43 ++++++
 .../processor/attr/SlingUnwrapAttrProcessor.java   |  43 ++++++
 12 files changed, 630 insertions(+)

diff --git a/pom.xml b/pom.xml
index 90ec732..08bd192 100644
--- a/pom.xml
+++ b/pom.xml
@@ -87,6 +87,12 @@
     </dependency>
     <dependency>
       <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.scripting.core</artifactId>
+      <version>2.0.29-SNAPSHOT</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.sling</groupId>
       <artifactId>org.apache.sling.commons.osgi</artifactId>
       <version>2.2.0</version>
       <scope>provided</scope>
diff --git 
a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/dialect/SlingDialect.java
 
b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/dialect/SlingDialect.java
new file mode 100644
index 0000000..92410f5
--- /dev/null
+++ 
b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/dialect/SlingDialect.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.scripting.thymeleaf.internal.dialect;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Properties;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Service;
+import 
org.apache.sling.scripting.thymeleaf.internal.processor.attr.SlingAddSelectorsAttrProcessor;
+import 
org.apache.sling.scripting.thymeleaf.internal.processor.attr.SlingIncludeAttrProcessor;
+import 
org.apache.sling.scripting.thymeleaf.internal.processor.attr.SlingPathAttrProcessor;
+import 
org.apache.sling.scripting.thymeleaf.internal.processor.attr.SlingReplaceSelectorsAttrProcessor;
+import 
org.apache.sling.scripting.thymeleaf.internal.processor.attr.SlingReplaceSuffixAttrProcessor;
+import 
org.apache.sling.scripting.thymeleaf.internal.processor.attr.SlingResourceAttrProcessor;
+import 
org.apache.sling.scripting.thymeleaf.internal.processor.attr.SlingResourceTypeAttrProcessor;
+import 
org.apache.sling.scripting.thymeleaf.internal.processor.attr.SlingUnwrapAttrProcessor;
+import org.osgi.framework.Constants;
+import org.thymeleaf.dialect.AbstractDialect;
+import org.thymeleaf.processor.IProcessor;
+
+@Component(
+    label = "Apache Sling Scripting Thymeleaf “Sling Dialect”",
+    description = "Sling dialect for Sling Scripting Thymeleaf",
+    immediate = true,
+    metatype = true
+)
+@Service
+@Properties({
+    @Property(name = Constants.SERVICE_VENDOR, value = "The Apache Software 
Foundation"),
+    @Property(name = Constants.SERVICE_DESCRIPTION, value = "Sling dialect for 
Sling Scripting Thymeleaf")
+})
+public class SlingDialect extends AbstractDialect {
+
+    public static final String PREFIX = "sling";
+
+    @Override
+    public String getPrefix() {
+        return PREFIX;
+    }
+
+    @Override
+    public Set<IProcessor> getProcessors() {
+        final Set<IProcessor> processors = new HashSet<IProcessor>();
+        processors.add(new SlingAddSelectorsAttrProcessor());
+        processors.add(new SlingIncludeAttrProcessor());
+        processors.add(new SlingPathAttrProcessor());
+        processors.add(new SlingReplaceSelectorsAttrProcessor());
+        processors.add(new SlingReplaceSuffixAttrProcessor());
+        processors.add(new SlingResourceAttrProcessor());
+        processors.add(new SlingResourceTypeAttrProcessor());
+        processors.add(new SlingUnwrapAttrProcessor());
+        return processors;
+    }
+
+}
diff --git 
a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/dom/NodeUtil.java 
b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/dom/NodeUtil.java
new file mode 100644
index 0000000..12c1a66
--- /dev/null
+++ 
b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/dom/NodeUtil.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.scripting.thymeleaf.internal.dom;
+
+import org.thymeleaf.dom.Node;
+
+public class NodeUtil {
+
+    public static <T> T getNodeProperty(final Node node, final String name, 
final Class<T> clazz) {
+        final Object nodeProperty = node.getNodeProperty(name);
+        try {
+            return clazz.cast(nodeProperty);
+        } catch (ClassCastException e) {
+            return null;
+        }
+    }
+
+}
diff --git 
a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/processor/attr/SlingAddSelectorsAttrProcessor.java
 
b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/processor/attr/SlingAddSelectorsAttrProcessor.java
new file mode 100644
index 0000000..562ed5a
--- /dev/null
+++ 
b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/processor/attr/SlingAddSelectorsAttrProcessor.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.scripting.thymeleaf.internal.processor.attr;
+
+public class SlingAddSelectorsAttrProcessor extends 
SlingNodePropertyAttrProcessor {
+
+    public static final int ATTR_PRECEDENCE = 99;
+
+    public static final String ATTR_NAME = "addSelectors";
+
+    public static final String NODE_PROPERTY_NAME = String.format("%s.%s", 
PREFIX, ATTR_NAME);
+
+    public SlingAddSelectorsAttrProcessor() {
+        super(ATTR_NAME);
+    }
+
+    @Override
+    public int getPrecedence() {
+        return ATTR_PRECEDENCE;
+    }
+
+    @Override
+    protected String getNodePropertyName() {
+        return NODE_PROPERTY_NAME;
+    }
+
+}
diff --git 
a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/processor/attr/SlingIncludeAttrProcessor.java
 
b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/processor/attr/SlingIncludeAttrProcessor.java
new file mode 100644
index 0000000..39214ae
--- /dev/null
+++ 
b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/processor/attr/SlingIncludeAttrProcessor.java
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.scripting.thymeleaf.internal.processor.attr;
+
+import java.io.IOException;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletException;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.SlingHttpServletResponse;
+import org.apache.sling.api.request.RequestDispatcherOptions;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceUtil;
+import org.apache.sling.api.resource.SyntheticResource;
+import org.apache.sling.scripting.core.servlet.BufferedServletOutputStream;
+import org.apache.sling.scripting.core.servlet.CaptureResponseWrapper;
+import org.apache.sling.scripting.thymeleaf.internal.SlingWebContext;
+import org.apache.sling.scripting.thymeleaf.internal.dom.NodeUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.thymeleaf.Arguments;
+import org.thymeleaf.context.IContext;
+import org.thymeleaf.dom.Element;
+import org.thymeleaf.dom.Macro;
+import org.thymeleaf.processor.ProcessorResult;
+import org.thymeleaf.processor.attr.AbstractAttrProcessor;
+
+public class SlingIncludeAttrProcessor extends AbstractAttrProcessor {
+
+    public static final int ATTR_PRECEDENCE = 100;
+
+    public static final String ATTR_NAME = "include";
+
+    private final Logger logger = 
LoggerFactory.getLogger(SlingIncludeAttrProcessor.class);
+
+    public SlingIncludeAttrProcessor() {
+        super(ATTR_NAME);
+    }
+
+    @Override
+    public int getPrecedence() {
+        return ATTR_PRECEDENCE;
+    }
+
+    @Override
+    protected ProcessorResult processAttribute(final Arguments arguments, 
final Element element, final String attributeName) {
+        final IContext context = 
arguments.getTemplateProcessingParameters().getContext();
+        if (context instanceof SlingWebContext) {
+            final SlingWebContext slingWebContext = (SlingWebContext) context;
+            final SlingHttpServletRequest slingHttpServletRequest = 
slingWebContext.getHttpServletRequest();
+            final SlingHttpServletResponse slingHttpServletResponse = 
slingWebContext.getHttpServletResponse();
+            // resource and path
+            Resource resource = NodeUtil.getNodeProperty(element, 
SlingResourceAttrProcessor.NODE_PROPERTY_NAME, Resource.class);
+            String path = NodeUtil.getNodeProperty(element, 
SlingPathAttrProcessor.NODE_PROPERTY_NAME, String.class);
+            // request dispatcher options
+            final String resourceType = NodeUtil.getNodeProperty(element, 
SlingResourceTypeAttrProcessor.NODE_PROPERTY_NAME, String.class);
+            final String replaceSelectors = NodeUtil.getNodeProperty(element, 
SlingReplaceSelectorsAttrProcessor.NODE_PROPERTY_NAME, String.class);
+            final String addSelectors = NodeUtil.getNodeProperty(element, 
SlingAddSelectorsAttrProcessor.NODE_PROPERTY_NAME, String.class);
+            final String replaceSuffix = NodeUtil.getNodeProperty(element, 
SlingReplaceSuffixAttrProcessor.NODE_PROPERTY_NAME, String.class);
+            // dispatch
+            final String content = dispatch(resource, path, 
slingHttpServletRequest, slingHttpServletResponse, resourceType, 
replaceSelectors, addSelectors, replaceSuffix);
+            // cleanup
+            element.removeAttribute(attributeName);
+            element.clearChildren();
+            // add output
+            final Macro macro = new Macro(content);
+            element.addChild(macro);
+            final Boolean unwrap = NodeUtil.getNodeProperty(element, 
SlingUnwrapAttrProcessor.NODE_PROPERTY_NAME, Boolean.class);
+            if (unwrap != null && unwrap) {
+                element.getParent().extractChild(element);
+            }
+        } else {
+            throw new RuntimeException("Context is not an instance of 
SlingWebContext, unable to process include attribute");
+        }
+        return ProcessorResult.OK;
+    }
+
+    /**
+     * @see org.apache.sling.scripting.jsp.taglib.IncludeTagHandler
+     */
+    protected String dispatch(Resource resource, String path, final 
SlingHttpServletRequest slingHttpServletRequest, final SlingHttpServletResponse 
slingHttpServletResponse, final String resourceType, final String 
replaceSelectors, final String addSelectors, final String replaceSuffix) {
+        final RequestDispatcherOptions options = new 
RequestDispatcherOptions();
+        options.setForceResourceType(resourceType);
+        options.setReplaceSelectors(replaceSelectors);
+        options.setAddSelectors(addSelectors);
+        options.setReplaceSuffix(replaceSuffix);
+
+        // ensure the path (if set) is absolute and normalized
+        if (path != null) {
+            if (!path.startsWith("/")) {
+                path = slingHttpServletRequest.getResource().getPath() + "/" + 
path;
+            }
+            path = ResourceUtil.normalize(path);
+        }
+
+        // check the resource
+        if (resource == null) {
+            if (path == null) {
+                // neither resource nor path is defined, use current resource
+                resource = slingHttpServletRequest.getResource();
+            } else {
+                // check whether the path (would) resolve, else SyntheticRes.
+                final Resource tmp = 
slingHttpServletRequest.getResourceResolver().resolve(path);
+                if (tmp == null && resourceType != null) {
+                    resource = new 
SyntheticResource(slingHttpServletRequest.getResourceResolver(), path, 
resourceType); // TODO DispatcherSyntheticResource?
+                    // remove resource type overwrite as synthetic resource is 
correctly typed as requested
+                    
options.remove(RequestDispatcherOptions.OPT_FORCE_RESOURCE_TYPE);
+                }
+            }
+        }
+
+        try {
+            // create a dispatcher for the resource or path
+            RequestDispatcher dispatcher;
+            if (resource != null) {
+                dispatcher = 
slingHttpServletRequest.getRequestDispatcher(resource, options);
+            } else {
+                dispatcher = 
slingHttpServletRequest.getRequestDispatcher(path, options);
+            }
+
+            if (dispatcher != null) {
+                final String encoding = 
slingHttpServletResponse.getCharacterEncoding();
+                final BufferedServletOutputStream bsos = new 
BufferedServletOutputStream(encoding);
+                try {
+                    final CaptureResponseWrapper wrapper = new 
CaptureResponseWrapper(slingHttpServletResponse, bsos);
+                    dispatcher.include(slingHttpServletRequest, wrapper);
+                    if (!wrapper.isBinaryResponse()) {
+                        wrapper.flushBuffer();
+                        return bsos.getBuffer();
+                    }
+                } catch (ServletException e) {
+                    logger.error(e.getMessage(), e);
+                } finally {
+                    IOUtils.closeQuietly(bsos);
+                }
+            } else {
+                logger.error("no request dispatcher: unable to include 
{}/'{}'", resource, path);
+            }
+        } catch (IOException e) {
+            logger.error(e.getMessage(), e);
+        }
+        return null;
+    }
+
+}
diff --git 
a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/processor/attr/SlingNodePropertyAttrProcessor.java
 
b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/processor/attr/SlingNodePropertyAttrProcessor.java
new file mode 100644
index 0000000..317d123
--- /dev/null
+++ 
b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/processor/attr/SlingNodePropertyAttrProcessor.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.scripting.thymeleaf.internal.processor.attr;
+
+import org.thymeleaf.Arguments;
+import org.thymeleaf.Configuration;
+import org.thymeleaf.dom.Element;
+import org.thymeleaf.processor.ProcessorResult;
+import org.thymeleaf.processor.attr.AbstractAttrProcessor;
+import org.thymeleaf.standard.expression.IStandardExpression;
+import org.thymeleaf.standard.expression.IStandardExpressionParser;
+import org.thymeleaf.standard.expression.StandardExpressions;
+
+public abstract class SlingNodePropertyAttrProcessor extends 
AbstractAttrProcessor {
+
+    public static final String PREFIX = "sling";
+
+    public SlingNodePropertyAttrProcessor(final String attributeName) {
+        super(attributeName);
+    }
+
+    protected abstract String getNodePropertyName();
+
+    @Override
+    protected ProcessorResult processAttribute(final Arguments arguments, 
final Element element, final String attributeName) {
+        final Configuration configuration = arguments.getConfiguration();
+        final String attributeValue = element.getAttributeValue(attributeName);
+        final IStandardExpressionParser parser = 
StandardExpressions.getExpressionParser(configuration);
+        final IStandardExpression expression = 
parser.parseExpression(configuration, arguments, attributeValue);
+        final Object result = expression.execute(configuration, arguments);
+        element.setNodeProperty(getNodePropertyName(), result);
+        element.removeAttribute(attributeName);
+        return ProcessorResult.OK;
+    }
+
+}
diff --git 
a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/processor/attr/SlingPathAttrProcessor.java
 
b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/processor/attr/SlingPathAttrProcessor.java
new file mode 100644
index 0000000..372bf82
--- /dev/null
+++ 
b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/processor/attr/SlingPathAttrProcessor.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.scripting.thymeleaf.internal.processor.attr;
+
+public class SlingPathAttrProcessor extends SlingNodePropertyAttrProcessor {
+
+    public static final int ATTR_PRECEDENCE = 99;
+
+    public static final String ATTR_NAME = "path";
+
+    public static final String NODE_PROPERTY_NAME = String.format("%s.%s", 
PREFIX, ATTR_NAME);
+
+    public SlingPathAttrProcessor() {
+        super(ATTR_NAME);
+    }
+
+    @Override
+    public int getPrecedence() {
+        return ATTR_PRECEDENCE;
+    }
+
+    @Override
+    protected String getNodePropertyName() {
+        return NODE_PROPERTY_NAME;
+    }
+
+}
diff --git 
a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/processor/attr/SlingReplaceSelectorsAttrProcessor.java
 
b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/processor/attr/SlingReplaceSelectorsAttrProcessor.java
new file mode 100644
index 0000000..cb42cc9
--- /dev/null
+++ 
b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/processor/attr/SlingReplaceSelectorsAttrProcessor.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.scripting.thymeleaf.internal.processor.attr;
+
+public class SlingReplaceSelectorsAttrProcessor extends 
SlingNodePropertyAttrProcessor {
+
+    public static final int ATTR_PRECEDENCE = 99;
+
+    public static final String ATTR_NAME = "replaceSelectors";
+
+    public static final String NODE_PROPERTY_NAME = String.format("%s.%s", 
PREFIX, ATTR_NAME);
+
+    public SlingReplaceSelectorsAttrProcessor() {
+        super(ATTR_NAME);
+    }
+
+    @Override
+    public int getPrecedence() {
+        return ATTR_PRECEDENCE;
+    }
+
+    @Override
+    protected String getNodePropertyName() {
+        return NODE_PROPERTY_NAME;
+    }
+
+}
diff --git 
a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/processor/attr/SlingReplaceSuffixAttrProcessor.java
 
b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/processor/attr/SlingReplaceSuffixAttrProcessor.java
new file mode 100644
index 0000000..91c7599
--- /dev/null
+++ 
b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/processor/attr/SlingReplaceSuffixAttrProcessor.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.scripting.thymeleaf.internal.processor.attr;
+
+public class SlingReplaceSuffixAttrProcessor extends 
SlingNodePropertyAttrProcessor {
+
+    public static final int ATTR_PRECEDENCE = 99;
+
+    public static final String ATTR_NAME = "replaceSuffix";
+
+    public static final String NODE_PROPERTY_NAME = String.format("%s.%s", 
PREFIX, ATTR_NAME);
+
+    public SlingReplaceSuffixAttrProcessor() {
+        super(ATTR_NAME);
+    }
+
+    @Override
+    public int getPrecedence() {
+        return ATTR_PRECEDENCE;
+    }
+
+    @Override
+    protected String getNodePropertyName() {
+        return NODE_PROPERTY_NAME;
+    }
+
+}
diff --git 
a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/processor/attr/SlingResourceAttrProcessor.java
 
b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/processor/attr/SlingResourceAttrProcessor.java
new file mode 100644
index 0000000..bd30c79
--- /dev/null
+++ 
b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/processor/attr/SlingResourceAttrProcessor.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.scripting.thymeleaf.internal.processor.attr;
+
+public class SlingResourceAttrProcessor extends SlingNodePropertyAttrProcessor 
{
+
+    public static final int ATTR_PRECEDENCE = 99;
+
+    public static final String ATTR_NAME = "resource";
+
+    public static final String NODE_PROPERTY_NAME = String.format("%s.%s", 
PREFIX, ATTR_NAME);
+
+    public SlingResourceAttrProcessor() {
+        super(ATTR_NAME);
+    }
+
+    @Override
+    public int getPrecedence() {
+        return ATTR_PRECEDENCE;
+    }
+
+    @Override
+    protected String getNodePropertyName() {
+        return NODE_PROPERTY_NAME;
+    }
+
+}
diff --git 
a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/processor/attr/SlingResourceTypeAttrProcessor.java
 
b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/processor/attr/SlingResourceTypeAttrProcessor.java
new file mode 100644
index 0000000..4d9a214
--- /dev/null
+++ 
b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/processor/attr/SlingResourceTypeAttrProcessor.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.scripting.thymeleaf.internal.processor.attr;
+
+public class SlingResourceTypeAttrProcessor extends 
SlingNodePropertyAttrProcessor {
+
+    public static final int ATTR_PRECEDENCE = 99;
+
+    public static final String ATTR_NAME = "resourceType";
+
+    public static final String NODE_PROPERTY_NAME = String.format("%s.%s", 
PREFIX, ATTR_NAME);
+
+    public SlingResourceTypeAttrProcessor() {
+        super(ATTR_NAME);
+    }
+
+    @Override
+    public int getPrecedence() {
+        return ATTR_PRECEDENCE;
+    }
+
+    @Override
+    protected String getNodePropertyName() {
+        return NODE_PROPERTY_NAME;
+    }
+
+}
diff --git 
a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/processor/attr/SlingUnwrapAttrProcessor.java
 
b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/processor/attr/SlingUnwrapAttrProcessor.java
new file mode 100644
index 0000000..4fd1af6
--- /dev/null
+++ 
b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/processor/attr/SlingUnwrapAttrProcessor.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.scripting.thymeleaf.internal.processor.attr;
+
+public class SlingUnwrapAttrProcessor extends SlingNodePropertyAttrProcessor {
+
+    public static final int ATTR_PRECEDENCE = 99;
+
+    public static final String ATTR_NAME = "unwrap";
+
+    public static final String NODE_PROPERTY_NAME = String.format("%s.%s", 
PREFIX, ATTR_NAME);
+
+    public SlingUnwrapAttrProcessor() {
+        super(ATTR_NAME);
+    }
+
+    @Override
+    public int getPrecedence() {
+        return ATTR_PRECEDENCE;
+    }
+
+    @Override
+    protected String getNodePropertyName() {
+        return NODE_PROPERTY_NAME;
+    }
+
+}

-- 
To stop receiving notification emails like this one, please contact
"[email protected]" <[email protected]>.

Reply via email to