You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 10:24:08 UTC

[sling-org-apache-sling-urlrewriter] annotated tag org.apache.sling.urlrewriter-0.0.2 created (now fc47d40)

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

rombert pushed a change to annotated tag org.apache.sling.urlrewriter-0.0.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-urlrewriter.git.


      at fc47d40  (tag)
 tagging 6bde895bf3603319192642e1bcc162f558f8ade2 (commit)
      by Oliver Lietz
      on Tue Feb 24 14:23:48 2015 +0000

- Log -----------------------------------------------------------------
org.apache.sling.urlrewriter-0.0.2
-----------------------------------------------------------------------

This annotated tag includes the following new commits:

     new fef5704  SLING-3518 add initial version of Apache Sling URL Rewriter
     new 750c792  SLING-3518 remove default name, don't use properties for label and description
     new 7328036  update to parent version 20
     new f94a114  SLING-3518 make filter internal
     new c9a65a2  SLING-3518 add a multipurpose filter based on Tuckey's UrlRewriteFilter
     new 029dd06  SLING-3518 add a multipurpose filter based on Tuckey's UrlRewriteFilter
     new 34174a2  SLING-3518 add a multipurpose filter based on Tuckey's UrlRewriteFilter
     new 72aae20  SLING-3518 add a multipurpose filter based on Tuckey's UrlRewriteFilter
     new 84ddadc  [maven-release-plugin] prepare release org.apache.sling.urlrewriter-0.0.2
     new 6bde895  [maven-release-plugin]  copy for tag org.apache.sling.urlrewriter-0.0.2

The 10 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


-- 
To stop receiving notification emails like this one, please contact
['"commits@sling.apache.org" <co...@sling.apache.org>'].

[sling-org-apache-sling-urlrewriter] 07/10: SLING-3518 add a multipurpose filter based on Tuckey's UrlRewriteFilter

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 34174a26807da2453d09c6f08686644ce89e9fe1
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Tue Feb 24 13:56:51 2015 +0000

    SLING-3518 add a multipurpose filter based on Tuckey's UrlRewriteFilter
    
    * style
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/urlrewriter@1661953 13f79535-47bb-0310-9956-ffa450edef68
---
 .../internal/SlingUrlRewriteFilter.java            | 24 ++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/sling/urlrewriter/internal/SlingUrlRewriteFilter.java b/src/main/java/org/apache/sling/urlrewriter/internal/SlingUrlRewriteFilter.java
index 6427889..cca2d81 100644
--- a/src/main/java/org/apache/sling/urlrewriter/internal/SlingUrlRewriteFilter.java
+++ b/src/main/java/org/apache/sling/urlrewriter/internal/SlingUrlRewriteFilter.java
@@ -65,10 +65,26 @@ import org.xml.sax.helpers.DefaultHandler;
 )
 @Service
 @Properties({
-    @Property(name = Constants.SERVICE_VENDOR, value = "The Apache Software Foundation"),
-    @Property(name = Constants.SERVICE_DESCRIPTION, value = "multi-purpose service for altering HTTP requests/responses based on Tuckey's UrlRewriteFilter"),
-    @Property(name = Constants.SERVICE_RANKING, intValue = 0, propertyPrivate = false),
-    @Property(name = EngineConstants.SLING_FILTER_SCOPE, value = {EngineConstants.FILTER_SCOPE_REQUEST, EngineConstants.FILTER_SCOPE_FORWARD})
+    @Property(
+        name = Constants.SERVICE_VENDOR,
+        value = "The Apache Software Foundation"
+    ),
+    @Property(
+        name = Constants.SERVICE_DESCRIPTION,
+        value = "multi-purpose service for altering HTTP requests/responses based on Tuckey's UrlRewriteFilter"
+    ),
+    @Property(
+        name = Constants.SERVICE_RANKING,
+        intValue = 0,
+        propertyPrivate = false
+    ),
+    @Property(
+        name = EngineConstants.SLING_FILTER_SCOPE,
+        value = {
+            EngineConstants.FILTER_SCOPE_REQUEST,
+            EngineConstants.FILTER_SCOPE_FORWARD
+        }
+    )
 })
 public final class SlingUrlRewriteFilter implements Filter {
 

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-urlrewriter] 01/10: SLING-3518 add initial version of Apache Sling URL Rewriter

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit fef5704a928b4da3c4c79a4a5c56f5cbd6d83a0c
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Mon Jun 2 20:45:28 2014 +0000

    SLING-3518 add initial version of Apache Sling URL Rewriter
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/urlrewriter@1599355 13f79535-47bb-0310-9956-ffa450edef68
---
 README.md                                          |  19 ++
 pom.xml                                            | 148 ++++++++++++++
 .../sling/urlrewriter/SlingUrlRewriteFilter.java   | 220 +++++++++++++++++++++
 .../OSGI-INF/metatype/metatype.properties          |  29 +++
 4 files changed, 416 insertions(+)

diff --git a/README.md b/README.md
new file mode 100644
index 0000000..be81b6b
--- /dev/null
+++ b/README.md
@@ -0,0 +1,19 @@
+Apache Sling URL Rewriter
+=========================
+
+multi-purpose service for altering HTTP requests/responses based on Tuckey's UrlRewriteFilter
+
+* http://tuckey.org/urlrewrite/manual/4.0/guide.html
+* http://urlrewritefilter.googlecode.com/svn/trunk/src/doc/manual/4.0/index.html
+
+example for setting a Cache-Control header:
+
+    <?xml version="1.0" encoding="utf-8"?>
+    <!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 4.0//EN" "http://www.tuckey.org/res/dtds/urlrewrite4.0.dtd">
+    <urlrewrite>
+      <rule>
+        <from>.*</from>
+        <set type="response-header" name="Cache-Control">max-age=600</set>
+      </rule>
+    </urlrewrite>
+
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..4a11de5
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.sling</groupId>
+    <artifactId>sling</artifactId>
+    <version>19</version>
+    <relativePath>../../../parent/pom.xml</relativePath>
+  </parent>
+
+  <artifactId>org.apache.sling.urlrewriter</artifactId>
+  <version>0.0.1-SNAPSHOT</version>
+  <packaging>bundle</packaging>
+
+  <name>Apache Sling URL Rewriter</name>
+  <description>Apache Sling URL Rewriter</description>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+    <sling.java.version>6</sling.java.version>
+  </properties>
+
+  <scm>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/urlrewriter</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/urlrewriter</developerConnection>
+    <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/urlrewriter</url>
+  </scm>
+
+  <dependencies>
+    <!-- javax -->
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <!-- OSGi -->
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.core</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.compendium</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <!-- Apache Commons -->
+    <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+      <version>2.4</version>
+      <scope>provided</scope>
+    </dependency>
+    <!-- Apache Sling -->
+    <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.engine</artifactId>
+      <version>2.3.2</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>
+    </dependency>
+    <!-- Apache Felix -->
+    <dependency>
+      <groupId>org.apache.felix</groupId>
+      <artifactId>org.apache.felix.scr.annotations</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <!-- UrlRewriteFilter -->
+    <dependency>
+      <groupId>org.tuckey</groupId>
+      <artifactId>urlrewritefilter</artifactId>
+      <version>4.0.4</version>
+      <scope>provided</scope>
+    </dependency>
+    <!-- logging -->
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <version>1.7.7</version>
+      <scope>provided</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.1</version>
+        <configuration>
+          <source>1.6</source>
+          <target>1.6</target>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Bundle-Category>sling</Bundle-Category>
+            <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+            <Export-Package/>
+            <Embed-Dependency>
+              org.apache.sling.commons.osgi;inline="org/apache/sling/commons/osgi/PropertiesUtil.*"
+            </Embed-Dependency>
+            <_removeheaders>
+              Embed-Dependency,
+              Private-Package,
+              Include-Resource
+            </_removeheaders>
+          </instructions>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-scr-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>
diff --git a/src/main/java/org/apache/sling/urlrewriter/SlingUrlRewriteFilter.java b/src/main/java/org/apache/sling/urlrewriter/SlingUrlRewriteFilter.java
new file mode 100644
index 0000000..6a476ad
--- /dev/null
+++ b/src/main/java/org/apache/sling/urlrewriter/SlingUrlRewriteFilter.java
@@ -0,0 +1,220 @@
+/*
+ * 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.urlrewriter;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Dictionary;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Modified;
+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.commons.osgi.PropertiesUtil;
+import org.apache.sling.engine.EngineConstants;
+import org.osgi.framework.Constants;
+import org.osgi.service.component.ComponentContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.tuckey.web.filters.urlrewrite.Conf;
+import org.tuckey.web.filters.urlrewrite.UrlRewriter;
+import org.tuckey.web.filters.urlrewrite.utils.Log;
+import org.tuckey.web.filters.urlrewrite.utils.StringUtils;
+import org.w3c.dom.Document;
+import org.xml.sax.helpers.DefaultHandler;
+
+@Component(
+    name = "org.apache.sling.urlrewriter.SlingUrlRewriteFilter",
+    label = "%org.apache.sling.urlrewriter.label",
+    description = "%org.apache.sling.urlrewriter.description",
+    immediate = true,
+    metatype = true
+)
+@Service
+@Properties({
+    @Property(name = Constants.SERVICE_VENDOR, value = "The Apache Software Foundation"),
+    @Property(name = Constants.SERVICE_DESCRIPTION, value = "multi-purpose service for altering HTTP requests/responses based on Tuckey's UrlRewriteFilter"),
+    @Property(name = Constants.SERVICE_RANKING, intValue = 0, propertyPrivate = false),
+    @Property(name = EngineConstants.SLING_FILTER_SCOPE, value = {EngineConstants.FILTER_SCOPE_REQUEST, EngineConstants.FILTER_SCOPE_FORWARD})
+})
+public class SlingUrlRewriteFilter implements Filter {
+
+    private UrlRewriter rewriter;
+
+    public static final String DEFAULT_REWRITE_RULES = "<?xml version=\"1.0\" encoding=\"utf-8\"?><!DOCTYPE urlrewrite PUBLIC \"-//tuckey.org//DTD UrlRewrite 4.0//EN\" \"http://www.tuckey.org/res/dtds/urlrewrite4.0.dtd\"><urlrewrite/>";
+
+    @Property(value = DEFAULT_REWRITE_RULES)
+    public static final String REWRITE_RULES_PARAMETER = "org.apache.sling.urlrewriter.rewrite.rules";
+
+    private final Logger logger = LoggerFactory.getLogger(SlingUrlRewriteFilter.class);
+
+    public SlingUrlRewriteFilter() {
+        Log.setLevel("SLF4J");
+    }
+
+    @Activate
+    private void activate(final ComponentContext context) {
+        logger.debug("activate");
+        configure(context);
+    }
+
+    @Modified
+    private void modified(final ComponentContext context) {
+        logger.debug("modified");
+        configure(context);
+    }
+
+    @Deactivate
+    private void deactivate() {
+        logger.debug("deactivate");
+        clearRewriter();
+    }
+
+    private synchronized void configure(final ComponentContext context) {
+        logger.info("configuring URL rewriter");
+        final Dictionary properties = context.getProperties();
+        final String rules = PropertiesUtil.toString(properties.get(REWRITE_RULES_PARAMETER), DEFAULT_REWRITE_RULES);
+
+        final Document document = createDocument(rules);
+        if (document == null) {
+            logger.error("creating rules document failed");
+            return;
+        }
+
+        final Conf conf = new DocumentConf(document);
+        conf.initialise();
+        clearRewriter();
+
+        if (conf.isOk()) {
+            logger.info("rewrite configuration is ok");
+        } else {
+            logger.error("rewrite configuration is NOT ok");
+            return;
+        }
+
+        rewriter = new UrlRewriter(conf);
+        logger.info("rewrite engine is enabled: {}", conf.isEngineEnabled());
+        if (conf.getRules() != null) {
+            logger.info("number of rewrite rules: {}", conf.getRules().size());
+        } else {
+            logger.info("no rewrite rules");
+        }
+    }
+
+    @Override
+    public void destroy() {
+        logger.debug("destroy()");
+    }
+
+    @Override
+    public void init(final FilterConfig filterConfig) throws ServletException {
+        logger.debug("init({})", filterConfig);
+    }
+
+    @Override
+    public void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse, final FilterChain filterChain) throws IOException, ServletException {
+        logger.debug("do filter");
+        if (rewriter != null && servletRequest instanceof HttpServletRequest && servletResponse instanceof HttpServletResponse) {
+            final HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
+            final HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse;
+            final boolean handled = rewriter.processRequest(httpServletRequest, httpServletResponse, filterChain);
+            if (handled) {
+                logger.debug("request handled by rewriter");
+                return;
+            }
+        }
+        logger.debug("request NOT handled by rewriter");
+        filterChain.doFilter(servletRequest, servletResponse);
+    }
+
+    private Document createDocument(final String rules) {
+        if (StringUtils.isBlank(rules)) {
+            logger.warn("given rules are blank");
+            return null;
+        }
+
+        final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+        factory.setValidating(true);
+        factory.setNamespaceAware(true);
+        factory.setIgnoringComments(true);
+        factory.setIgnoringElementContentWhitespace(true);
+
+        try {
+            final String systemId = "";
+            final ConfHandler confHandler = new ConfHandler(systemId);
+            final DocumentBuilder documentBuilder = factory.newDocumentBuilder();
+            documentBuilder.setErrorHandler(confHandler);
+            documentBuilder.setEntityResolver(confHandler);
+
+            final InputStream inputStream = new ByteArrayInputStream(rules.getBytes("UTF-8"));
+            final Document document = documentBuilder.parse(inputStream); // , systemId);
+            IOUtils.closeQuietly(inputStream);
+            return document;
+        } catch (Exception e) {
+            logger.error("error creating document from rules property", e);
+            return null;
+        }
+    }
+
+    private synchronized void clearRewriter() {
+        if (rewriter != null) {
+            rewriter.destroy();
+            rewriter = null;
+        }
+    }
+
+    public class DocumentConf extends Conf {
+
+        public DocumentConf(final Document rules) {
+            processConfDoc(rules);
+            // TODO check docProcessed
+            initialise();
+            // TODO set loadedDate
+        }
+
+    }
+
+    // TODO
+    public class ConfHandler extends DefaultHandler {
+
+        protected final String systemId;
+
+        public ConfHandler(final String systemId) {
+            this.systemId = systemId;
+        }
+
+    }
+
+}
diff --git a/src/main/resources/OSGI-INF/metatype/metatype.properties b/src/main/resources/OSGI-INF/metatype/metatype.properties
new file mode 100644
index 0000000..38be239
--- /dev/null
+++ b/src/main/resources/OSGI-INF/metatype/metatype.properties
@@ -0,0 +1,29 @@
+#
+#  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.
+#
+
+service.ranking.name = service ranking
+service.ranking.description = service property for identifying the service's ranking number
+
+sling.filter.scope.name = filter scopes
+sling.filter.scope.description = see http://sling.apache.org/documentation/the-sling-engine/filters.html
+
+org.apache.sling.urlrewriter.label = Apache Sling URL Rewriter
+org.apache.sling.urlrewriter.description = multi-purpose service for altering HTTP requests/responses based on Tuckey's UrlRewriteFilter
+org.apache.sling.urlrewriter.rewrite.rules.name = rewrite rules (urlrewrite.xml)
+org.apache.sling.urlrewriter.rewrite.rules.description = see http://urlrewritefilter.googlecode.com/svn/trunk/src/doc/manual/4.0/index.html#configuration

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-urlrewriter] 04/10: SLING-3518 make filter internal

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit f94a11478d323cc2c5c520acee3da8d87ca2888c
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Fri Jan 23 09:32:06 2015 +0000

    SLING-3518 make filter internal
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/urlrewriter@1654155 13f79535-47bb-0310-9956-ffa450edef68
---
 .../apache/sling/urlrewriter/{ => internal}/SlingUrlRewriteFilter.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/urlrewriter/SlingUrlRewriteFilter.java b/src/main/java/org/apache/sling/urlrewriter/internal/SlingUrlRewriteFilter.java
similarity index 99%
rename from src/main/java/org/apache/sling/urlrewriter/SlingUrlRewriteFilter.java
rename to src/main/java/org/apache/sling/urlrewriter/internal/SlingUrlRewriteFilter.java
index 1901a48..fbc5d7f 100644
--- a/src/main/java/org/apache/sling/urlrewriter/SlingUrlRewriteFilter.java
+++ b/src/main/java/org/apache/sling/urlrewriter/internal/SlingUrlRewriteFilter.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.sling.urlrewriter;
+package org.apache.sling.urlrewriter.internal;
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-urlrewriter] 02/10: SLING-3518 remove default name, don't use properties for label and description

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 750c79260f43f8dab6d35cfff9a3004135883d28
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Tue Jun 17 04:25:34 2014 +0000

    SLING-3518 remove default name, don't use properties for label and description
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/urlrewriter@1603053 13f79535-47bb-0310-9956-ffa450edef68
---
 .../java/org/apache/sling/urlrewriter/SlingUrlRewriteFilter.java     | 5 ++---
 src/main/resources/OSGI-INF/metatype/metatype.properties             | 2 --
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/sling/urlrewriter/SlingUrlRewriteFilter.java b/src/main/java/org/apache/sling/urlrewriter/SlingUrlRewriteFilter.java
index 6a476ad..1901a48 100644
--- a/src/main/java/org/apache/sling/urlrewriter/SlingUrlRewriteFilter.java
+++ b/src/main/java/org/apache/sling/urlrewriter/SlingUrlRewriteFilter.java
@@ -56,9 +56,8 @@ import org.w3c.dom.Document;
 import org.xml.sax.helpers.DefaultHandler;
 
 @Component(
-    name = "org.apache.sling.urlrewriter.SlingUrlRewriteFilter",
-    label = "%org.apache.sling.urlrewriter.label",
-    description = "%org.apache.sling.urlrewriter.description",
+    label = "Apache Sling URL Rewriter",
+    description = "multi-purpose service for altering HTTP requests/responses based on Tuckey's UrlRewriteFilter",
     immediate = true,
     metatype = true
 )
diff --git a/src/main/resources/OSGI-INF/metatype/metatype.properties b/src/main/resources/OSGI-INF/metatype/metatype.properties
index 38be239..91ef40c 100644
--- a/src/main/resources/OSGI-INF/metatype/metatype.properties
+++ b/src/main/resources/OSGI-INF/metatype/metatype.properties
@@ -23,7 +23,5 @@ service.ranking.description = service property for identifying the service's ran
 sling.filter.scope.name = filter scopes
 sling.filter.scope.description = see http://sling.apache.org/documentation/the-sling-engine/filters.html
 
-org.apache.sling.urlrewriter.label = Apache Sling URL Rewriter
-org.apache.sling.urlrewriter.description = multi-purpose service for altering HTTP requests/responses based on Tuckey's UrlRewriteFilter
 org.apache.sling.urlrewriter.rewrite.rules.name = rewrite rules (urlrewrite.xml)
 org.apache.sling.urlrewriter.rewrite.rules.description = see http://urlrewritefilter.googlecode.com/svn/trunk/src/doc/manual/4.0/index.html#configuration

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-urlrewriter] 03/10: update to parent version 20

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 7328036b8facdbc8a6052c3fbb9c3952ef297b29
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Mon Aug 4 18:07:50 2014 +0000

    update to parent version 20
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/urlrewriter@1615715 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 4a11de5..4f5f441 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
   <parent>
     <groupId>org.apache.sling</groupId>
     <artifactId>sling</artifactId>
-    <version>19</version>
+    <version>20</version>
     <relativePath>../../../parent/pom.xml</relativePath>
   </parent>
 

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-urlrewriter] 08/10: SLING-3518 add a multipurpose filter based on Tuckey's UrlRewriteFilter

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 72aae20871c211922cac727a04581b313a26bd8e
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Tue Feb 24 14:15:40 2015 +0000

    SLING-3518 add a multipurpose filter based on Tuckey's UrlRewriteFilter
    
    * update to current parent
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/urlrewriter@1661955 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 328c0cf..982b25f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
   <parent>
     <groupId>org.apache.sling</groupId>
     <artifactId>sling</artifactId>
-    <version>20</version>
+    <version>22</version>
     <relativePath>../../../parent/pom.xml</relativePath>
   </parent>
 

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-urlrewriter] 10/10: [maven-release-plugin] copy for tag org.apache.sling.urlrewriter-0.0.2

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 6bde895bf3603319192642e1bcc162f558f8ade2
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Tue Feb 24 14:23:48 2015 +0000

    [maven-release-plugin]  copy for tag org.apache.sling.urlrewriter-0.0.2
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.urlrewriter-0.0.2@1661962 13f79535-47bb-0310-9956-ffa450edef68

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-urlrewriter] 09/10: [maven-release-plugin] prepare release org.apache.sling.urlrewriter-0.0.2

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 84ddadcd0973079eef585c11d9bb25b203d5ec73
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Tue Feb 24 14:23:21 2015 +0000

    [maven-release-plugin] prepare release org.apache.sling.urlrewriter-0.0.2
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/urlrewriter@1661961 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/pom.xml b/pom.xml
index 982b25f..0406dbb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,7 +29,7 @@
   </parent>
 
   <artifactId>org.apache.sling.urlrewriter</artifactId>
-  <version>0.0.1-SNAPSHOT</version>
+  <version>0.0.2</version>
   <packaging>bundle</packaging>
 
   <name>Apache Sling URL Rewriter</name>
@@ -42,9 +42,9 @@
   </properties>
 
   <scm>
-    <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/urlrewriter</connection>
-    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/urlrewriter</developerConnection>
-    <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/urlrewriter</url>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.urlrewriter-0.0.2</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.urlrewriter-0.0.2</developerConnection>
+    <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.urlrewriter-0.0.2</url>
   </scm>
 
   <dependencies>
@@ -124,7 +124,7 @@
         <extensions>true</extensions>
         <configuration>
           <instructions>
-            <Export-Package/>
+            <Export-Package />
             <Embed-Dependency>
               org.apache.sling.commons.osgi;inline="org/apache/sling/commons/osgi/PropertiesUtil.*"
             </Embed-Dependency>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-urlrewriter] 06/10: SLING-3518 add a multipurpose filter based on Tuckey's UrlRewriteFilter

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 029dd0601bd723e3ba69faab4220fa96f964f127
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Sat Feb 14 16:52:22 2015 +0000

    SLING-3518 add a multipurpose filter based on Tuckey's UrlRewriteFilter
    
    * add example for setting CORS headers
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/urlrewriter@1659812 13f79535-47bb-0310-9956-ffa450edef68
---
 README.md | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/README.md b/README.md
index be81b6b..8e996bd 100644
--- a/README.md
+++ b/README.md
@@ -17,3 +17,25 @@ example for setting a Cache-Control header:
       </rule>
     </urlrewrite>
 
+example for setting CORS headers:
+
+    <?xml version="1.0" encoding="UTF-8"?>
+    <!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 4.0//EN" "http://www.tuckey.org/res/dtds/urlrewrite4.0.dtd">
+    <urlrewrite>
+      <rule>
+        <note>
+          http://www.w3.org/TR/cors/
+          https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS
+          http://fetch.spec.whatwg.org
+          http://enable-cors.org
+          http://www.html5rocks.com/en/tutorials/cors/
+        </note>
+        <condition type="header" name="Origin">.*</condition>
+        <condition type="header" name="Access-Control-Request-Method">.*</condition>
+        <condition type="header" name="Access-Control-Request-Headers">.*</condition>
+        <set type="response-header" name="Access-Control-Allow-Origin">%{header:Origin}</set>
+        <set type="response-header" name="Access-Control-Allow-Methods">%{header:Access-Control-Request-Method}</set>
+        <set type="response-header" name="Access-Control-Allow-Headers">%{header:Access-Control-Request-Headers}</set>
+        <set type="response-header" name="Access-Control-Allow-Credentials">true</set>
+      </rule>
+    </urlrewrite>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-urlrewriter] 05/10: SLING-3518 add a multipurpose filter based on Tuckey's UrlRewriteFilter

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit c9a65a2bfe11f18fe2a6bf6f80530d33b488ccc0
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Sat Feb 14 16:39:53 2015 +0000

    SLING-3518 add a multipurpose filter based on Tuckey's UrlRewriteFilter
    
    * remove duplicate bundle settings
    * require configuration for component
    * make filter final
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/urlrewriter@1659805 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                                           | 2 --
 .../apache/sling/urlrewriter/internal/SlingUrlRewriteFilter.java  | 8 +++++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/pom.xml b/pom.xml
index 4f5f441..328c0cf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -124,8 +124,6 @@
         <extensions>true</extensions>
         <configuration>
           <instructions>
-            <Bundle-Category>sling</Bundle-Category>
-            <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
             <Export-Package/>
             <Embed-Dependency>
               org.apache.sling.commons.osgi;inline="org/apache/sling/commons/osgi/PropertiesUtil.*"
diff --git a/src/main/java/org/apache/sling/urlrewriter/internal/SlingUrlRewriteFilter.java b/src/main/java/org/apache/sling/urlrewriter/internal/SlingUrlRewriteFilter.java
index fbc5d7f..6427889 100644
--- a/src/main/java/org/apache/sling/urlrewriter/internal/SlingUrlRewriteFilter.java
+++ b/src/main/java/org/apache/sling/urlrewriter/internal/SlingUrlRewriteFilter.java
@@ -37,6 +37,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
 import org.apache.commons.io.IOUtils;
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.ConfigurationPolicy;
 import org.apache.felix.scr.annotations.Deactivate;
 import org.apache.felix.scr.annotations.Modified;
 import org.apache.felix.scr.annotations.Properties;
@@ -59,7 +60,8 @@ import org.xml.sax.helpers.DefaultHandler;
     label = "Apache Sling URL Rewriter",
     description = "multi-purpose service for altering HTTP requests/responses based on Tuckey's UrlRewriteFilter",
     immediate = true,
-    metatype = true
+    metatype = true,
+    policy = ConfigurationPolicy.REQUIRE
 )
 @Service
 @Properties({
@@ -68,7 +70,7 @@ import org.xml.sax.helpers.DefaultHandler;
     @Property(name = Constants.SERVICE_RANKING, intValue = 0, propertyPrivate = false),
     @Property(name = EngineConstants.SLING_FILTER_SCOPE, value = {EngineConstants.FILTER_SCOPE_REQUEST, EngineConstants.FILTER_SCOPE_FORWARD})
 })
-public class SlingUrlRewriteFilter implements Filter {
+public final class SlingUrlRewriteFilter implements Filter {
 
     private UrlRewriter rewriter;
 
@@ -101,7 +103,7 @@ public class SlingUrlRewriteFilter implements Filter {
         clearRewriter();
     }
 
-    private synchronized void configure(final ComponentContext context) {
+    private void configure(final ComponentContext context) {
         logger.info("configuring URL rewriter");
         final Dictionary properties = context.getProperties();
         final String rules = PropertiesUtil.toString(properties.get(REWRITE_RULES_PARAMETER), DEFAULT_REWRITE_RULES);

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.