[sling-org-apache-sling-hc-support] branch master updated: SLING-9859 Use Conditional-Package for felix generalchecks util package
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git The following commit(s) were added to refs/heads/master by this push: new 7c331cd SLING-9859 Use Conditional-Package for felix generalchecks util package 7c331cd is described below commit 7c331cde0c821c35e60cd2c8e7323a4e765f5ba4 Author: georg.henzler AuthorDate: Wed Oct 28 00:22:38 2020 +0100 SLING-9859 Use Conditional-Package for felix generalchecks util package --- pom.xml | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 49e6f93..678f5ea 100644 --- a/pom.xml +++ b/pom.xml @@ -32,11 +32,11 @@ bundle 1.0.7-SNAPSHOT -Apache Sling Health Check Support Components +Apache Sling Health Check Support Bundle 2013 -Default Sling Health Check Support Components +Additional generic Health Checks in Sling. @@ -44,7 +44,7 @@ scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git https://gitbox.apache.org/repos/asf?p=sling-org-apache-sling-hc-support.git HEAD - + @@ -52,6 +52,11 @@ org.apache.felix maven-bundle-plugin true + + + org.apache.felix.hc.generalchecks.util + + @@ -73,7 +78,7 @@ osgi.annotation 6.0.1 provided - + org.apache.felix
[sling-site] branch master updated: Fix links in HC documentation
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-site.git The following commit(s) were added to refs/heads/master by this push: new 71e63c6 Fix links in HC documentation 71e63c6 is described below commit 71e63c631f76458e4fb3b1dbb4a9bec08ddf8745 Author: georg.henzler AuthorDate: Tue Oct 27 23:34:03 2020 +0100 Fix links in HC documentation --- .../jbake/content/documentation/bundles/sling-health-checks.md| 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/jbake/content/documentation/bundles/sling-health-checks.md b/src/main/jbake/content/documentation/bundles/sling-health-checks.md index e046088..805b92b 100644 --- a/src/main/jbake/content/documentation/bundles/sling-health-checks.md +++ b/src/main/jbake/content/documentation/bundles/sling-health-checks.md @@ -12,13 +12,13 @@ It is best practice to place health check next to the functionality they check. The below checks are exceptions to that rule as they are generic in what they check (but still require Sling features, that's whey they are not in Apache Felix). -# Apache Sling Health Check Support Module +# Apache Sling Health Check Support Bundle Check | PID | Factory | Description --- | --- | --- | --- -Default Logins Check | org.apache.sling.hc.support.DefaultLoginsHealthCheck | yes | Set a list of default logins in config array `logins` separed by `:`, e.g. `author:author` -Scripted Check | org.apache.felix.hc.generalchecks.ScriptedHealthCheck | yes | Allows to run an arbitrary script in the same way as the Scripted Check from from Apache Felix bundle [general checks](https://github.com/apache/felix/blob/trunk/healthcheck/README.md#general-purpose-health-checks-available-out-of-the-box), except that this check allows to use files being loaded from JCR by using a `scriptUrl` with prefix `jcr:`, e.g. `jcr:/apps/ops/my-custom-check.groovy` -Request Status Health Check | *Deprecated* | | Use instead the corresponding check from [general checks](https://github.com/apache/felix/blob/trunk/healthcheck/README.md#general-purpose-health-checks-available-out-of-the-box) +Default Logins Check | org.apache.sling.hc.support.DefaultLoginsHealthCheck | yes | Set a list of default logins in config array `logins` separated by `:`, e.g. `author:author` +Scripted Check | org.apache.sling.hc.support.impl.ScriptedHealthCheck | yes | Allows to run an arbitrary script in the same way as the Scripted Check `org.apache.felix.hc.generalchecks.ScriptedHealthCheck` from Apache Felix bundle [general checks](https://github.com/apache/felix-dev/blob/master/healthcheck/README.md#general-purpose-health-checks-available-out-of-the-box), except that this check allows to use files being loaded from JCR by using a `scriptUrl` with prefix `jcr:`, e.g. `jcr [...] +Request Status Health Check | *Deprecated* | | Use instead the corresponding check from [general checks](https://github.com/apache/felix-dev/blob/master/healthcheck/README.md#general-purpose-health-checks-available-out-of-the-box) # Health Checks as server-side JUnit tests The `org.apache.sling.hc.junit.bridge` bundle makes selected Health Checks available as server-side JUnit tests.
[sling-site] branch master updated: Fix links in HC documentation
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-site.git The following commit(s) were added to refs/heads/master by this push: new 71e63c6 Fix links in HC documentation 71e63c6 is described below commit 71e63c631f76458e4fb3b1dbb4a9bec08ddf8745 Author: georg.henzler AuthorDate: Tue Oct 27 23:34:03 2020 +0100 Fix links in HC documentation --- .../jbake/content/documentation/bundles/sling-health-checks.md| 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/jbake/content/documentation/bundles/sling-health-checks.md b/src/main/jbake/content/documentation/bundles/sling-health-checks.md index e046088..805b92b 100644 --- a/src/main/jbake/content/documentation/bundles/sling-health-checks.md +++ b/src/main/jbake/content/documentation/bundles/sling-health-checks.md @@ -12,13 +12,13 @@ It is best practice to place health check next to the functionality they check. The below checks are exceptions to that rule as they are generic in what they check (but still require Sling features, that's whey they are not in Apache Felix). -# Apache Sling Health Check Support Module +# Apache Sling Health Check Support Bundle Check | PID | Factory | Description --- | --- | --- | --- -Default Logins Check | org.apache.sling.hc.support.DefaultLoginsHealthCheck | yes | Set a list of default logins in config array `logins` separed by `:`, e.g. `author:author` -Scripted Check | org.apache.felix.hc.generalchecks.ScriptedHealthCheck | yes | Allows to run an arbitrary script in the same way as the Scripted Check from from Apache Felix bundle [general checks](https://github.com/apache/felix/blob/trunk/healthcheck/README.md#general-purpose-health-checks-available-out-of-the-box), except that this check allows to use files being loaded from JCR by using a `scriptUrl` with prefix `jcr:`, e.g. `jcr:/apps/ops/my-custom-check.groovy` -Request Status Health Check | *Deprecated* | | Use instead the corresponding check from [general checks](https://github.com/apache/felix/blob/trunk/healthcheck/README.md#general-purpose-health-checks-available-out-of-the-box) +Default Logins Check | org.apache.sling.hc.support.DefaultLoginsHealthCheck | yes | Set a list of default logins in config array `logins` separated by `:`, e.g. `author:author` +Scripted Check | org.apache.sling.hc.support.impl.ScriptedHealthCheck | yes | Allows to run an arbitrary script in the same way as the Scripted Check `org.apache.felix.hc.generalchecks.ScriptedHealthCheck` from Apache Felix bundle [general checks](https://github.com/apache/felix-dev/blob/master/healthcheck/README.md#general-purpose-health-checks-available-out-of-the-box), except that this check allows to use files being loaded from JCR by using a `scriptUrl` with prefix `jcr:`, e.g. `jcr [...] +Request Status Health Check | *Deprecated* | | Use instead the corresponding check from [general checks](https://github.com/apache/felix-dev/blob/master/healthcheck/README.md#general-purpose-health-checks-available-out-of-the-box) # Health Checks as server-side JUnit tests The `org.apache.sling.hc.junit.bridge` bundle makes selected Health Checks available as server-side JUnit tests.
[sling-site] branch master updated: Fix links in HC documentation
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-site.git The following commit(s) were added to refs/heads/master by this push: new 71e63c6 Fix links in HC documentation 71e63c6 is described below commit 71e63c631f76458e4fb3b1dbb4a9bec08ddf8745 Author: georg.henzler AuthorDate: Tue Oct 27 23:34:03 2020 +0100 Fix links in HC documentation --- .../jbake/content/documentation/bundles/sling-health-checks.md| 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/jbake/content/documentation/bundles/sling-health-checks.md b/src/main/jbake/content/documentation/bundles/sling-health-checks.md index e046088..805b92b 100644 --- a/src/main/jbake/content/documentation/bundles/sling-health-checks.md +++ b/src/main/jbake/content/documentation/bundles/sling-health-checks.md @@ -12,13 +12,13 @@ It is best practice to place health check next to the functionality they check. The below checks are exceptions to that rule as they are generic in what they check (but still require Sling features, that's whey they are not in Apache Felix). -# Apache Sling Health Check Support Module +# Apache Sling Health Check Support Bundle Check | PID | Factory | Description --- | --- | --- | --- -Default Logins Check | org.apache.sling.hc.support.DefaultLoginsHealthCheck | yes | Set a list of default logins in config array `logins` separed by `:`, e.g. `author:author` -Scripted Check | org.apache.felix.hc.generalchecks.ScriptedHealthCheck | yes | Allows to run an arbitrary script in the same way as the Scripted Check from from Apache Felix bundle [general checks](https://github.com/apache/felix/blob/trunk/healthcheck/README.md#general-purpose-health-checks-available-out-of-the-box), except that this check allows to use files being loaded from JCR by using a `scriptUrl` with prefix `jcr:`, e.g. `jcr:/apps/ops/my-custom-check.groovy` -Request Status Health Check | *Deprecated* | | Use instead the corresponding check from [general checks](https://github.com/apache/felix/blob/trunk/healthcheck/README.md#general-purpose-health-checks-available-out-of-the-box) +Default Logins Check | org.apache.sling.hc.support.DefaultLoginsHealthCheck | yes | Set a list of default logins in config array `logins` separated by `:`, e.g. `author:author` +Scripted Check | org.apache.sling.hc.support.impl.ScriptedHealthCheck | yes | Allows to run an arbitrary script in the same way as the Scripted Check `org.apache.felix.hc.generalchecks.ScriptedHealthCheck` from Apache Felix bundle [general checks](https://github.com/apache/felix-dev/blob/master/healthcheck/README.md#general-purpose-health-checks-available-out-of-the-box), except that this check allows to use files being loaded from JCR by using a `scriptUrl` with prefix `jcr:`, e.g. `jcr [...] +Request Status Health Check | *Deprecated* | | Use instead the corresponding check from [general checks](https://github.com/apache/felix-dev/blob/master/healthcheck/README.md#general-purpose-health-checks-available-out-of-the-box) # Health Checks as server-side JUnit tests The `org.apache.sling.hc.junit.bridge` bundle makes selected Health Checks available as server-side JUnit tests.
[sling-site] branch master updated: Fix links in HC documentation
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-site.git The following commit(s) were added to refs/heads/master by this push: new 71e63c6 Fix links in HC documentation 71e63c6 is described below commit 71e63c631f76458e4fb3b1dbb4a9bec08ddf8745 Author: georg.henzler AuthorDate: Tue Oct 27 23:34:03 2020 +0100 Fix links in HC documentation --- .../jbake/content/documentation/bundles/sling-health-checks.md| 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/jbake/content/documentation/bundles/sling-health-checks.md b/src/main/jbake/content/documentation/bundles/sling-health-checks.md index e046088..805b92b 100644 --- a/src/main/jbake/content/documentation/bundles/sling-health-checks.md +++ b/src/main/jbake/content/documentation/bundles/sling-health-checks.md @@ -12,13 +12,13 @@ It is best practice to place health check next to the functionality they check. The below checks are exceptions to that rule as they are generic in what they check (but still require Sling features, that's whey they are not in Apache Felix). -# Apache Sling Health Check Support Module +# Apache Sling Health Check Support Bundle Check | PID | Factory | Description --- | --- | --- | --- -Default Logins Check | org.apache.sling.hc.support.DefaultLoginsHealthCheck | yes | Set a list of default logins in config array `logins` separed by `:`, e.g. `author:author` -Scripted Check | org.apache.felix.hc.generalchecks.ScriptedHealthCheck | yes | Allows to run an arbitrary script in the same way as the Scripted Check from from Apache Felix bundle [general checks](https://github.com/apache/felix/blob/trunk/healthcheck/README.md#general-purpose-health-checks-available-out-of-the-box), except that this check allows to use files being loaded from JCR by using a `scriptUrl` with prefix `jcr:`, e.g. `jcr:/apps/ops/my-custom-check.groovy` -Request Status Health Check | *Deprecated* | | Use instead the corresponding check from [general checks](https://github.com/apache/felix/blob/trunk/healthcheck/README.md#general-purpose-health-checks-available-out-of-the-box) +Default Logins Check | org.apache.sling.hc.support.DefaultLoginsHealthCheck | yes | Set a list of default logins in config array `logins` separated by `:`, e.g. `author:author` +Scripted Check | org.apache.sling.hc.support.impl.ScriptedHealthCheck | yes | Allows to run an arbitrary script in the same way as the Scripted Check `org.apache.felix.hc.generalchecks.ScriptedHealthCheck` from Apache Felix bundle [general checks](https://github.com/apache/felix-dev/blob/master/healthcheck/README.md#general-purpose-health-checks-available-out-of-the-box), except that this check allows to use files being loaded from JCR by using a `scriptUrl` with prefix `jcr:`, e.g. `jcr [...] +Request Status Health Check | *Deprecated* | | Use instead the corresponding check from [general checks](https://github.com/apache/felix-dev/blob/master/healthcheck/README.md#general-purpose-health-checks-available-out-of-the-box) # Health Checks as server-side JUnit tests The `org.apache.sling.hc.junit.bridge` bundle makes selected Health Checks available as server-side JUnit tests.
[sling-site] branch master updated: Fix links in HC documentation
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-site.git The following commit(s) were added to refs/heads/master by this push: new 71e63c6 Fix links in HC documentation 71e63c6 is described below commit 71e63c631f76458e4fb3b1dbb4a9bec08ddf8745 Author: georg.henzler AuthorDate: Tue Oct 27 23:34:03 2020 +0100 Fix links in HC documentation --- .../jbake/content/documentation/bundles/sling-health-checks.md| 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/jbake/content/documentation/bundles/sling-health-checks.md b/src/main/jbake/content/documentation/bundles/sling-health-checks.md index e046088..805b92b 100644 --- a/src/main/jbake/content/documentation/bundles/sling-health-checks.md +++ b/src/main/jbake/content/documentation/bundles/sling-health-checks.md @@ -12,13 +12,13 @@ It is best practice to place health check next to the functionality they check. The below checks are exceptions to that rule as they are generic in what they check (but still require Sling features, that's whey they are not in Apache Felix). -# Apache Sling Health Check Support Module +# Apache Sling Health Check Support Bundle Check | PID | Factory | Description --- | --- | --- | --- -Default Logins Check | org.apache.sling.hc.support.DefaultLoginsHealthCheck | yes | Set a list of default logins in config array `logins` separed by `:`, e.g. `author:author` -Scripted Check | org.apache.felix.hc.generalchecks.ScriptedHealthCheck | yes | Allows to run an arbitrary script in the same way as the Scripted Check from from Apache Felix bundle [general checks](https://github.com/apache/felix/blob/trunk/healthcheck/README.md#general-purpose-health-checks-available-out-of-the-box), except that this check allows to use files being loaded from JCR by using a `scriptUrl` with prefix `jcr:`, e.g. `jcr:/apps/ops/my-custom-check.groovy` -Request Status Health Check | *Deprecated* | | Use instead the corresponding check from [general checks](https://github.com/apache/felix/blob/trunk/healthcheck/README.md#general-purpose-health-checks-available-out-of-the-box) +Default Logins Check | org.apache.sling.hc.support.DefaultLoginsHealthCheck | yes | Set a list of default logins in config array `logins` separated by `:`, e.g. `author:author` +Scripted Check | org.apache.sling.hc.support.impl.ScriptedHealthCheck | yes | Allows to run an arbitrary script in the same way as the Scripted Check `org.apache.felix.hc.generalchecks.ScriptedHealthCheck` from Apache Felix bundle [general checks](https://github.com/apache/felix-dev/blob/master/healthcheck/README.md#general-purpose-health-checks-available-out-of-the-box), except that this check allows to use files being loaded from JCR by using a `scriptUrl` with prefix `jcr:`, e.g. `jcr [...] +Request Status Health Check | *Deprecated* | | Use instead the corresponding check from [general checks](https://github.com/apache/felix-dev/blob/master/healthcheck/README.md#general-purpose-health-checks-available-out-of-the-box) # Health Checks as server-side JUnit tests The `org.apache.sling.hc.junit.bridge` bundle makes selected Health Checks available as server-side JUnit tests.
[sling-org-apache-sling-api] branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 updated (855191c -> 21dc4a2)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git. from 855191c SLING-9745 Using unique SNAPSHOT version add 21dc4a2 SLING-9745 Add the ability to force an absolute URI to API/SPI map signature No new revisions were added by this update. Summary of changes: .../apache/sling/api/resource/mapping/PathToUriMappingService.java| 3 ++- src/main/java/org/apache/sling/spi/urimapping/SlingUriMapper.java | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-)
[sling-org-apache-sling-api] branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 updated (f149adc -> 855191c)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git. discard f149adc SLING-9745 Sling Uri Mapping SPI add ebe211f SLING-9774 The ValueMapUtil#merge behavior is different from the deprecated CompositeValueMap add 99af984 SLING-9774 Use a simpler fix that also passes the tests. add 8615ff5 SLING-9777 Better handling for invalid URIs when using SlingUri (special characters, spaces) add 02088d2 Merge pull request #24 from apache/feature/SLING-9777-SlingUri-better-encoding-handling add 3e9cf18 SLING-9777 unit test for well-known URI add 610bae1 SLING-9745 Sling Uri Mapping SPI add 43f5804 SLING-9745 Use IntermediateMapping tuple instead of map add 855191c SLING-9745 Using unique SNAPSHOT version This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (f149adc) \ N -- N -- N refs/heads/feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 (855191c) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. No new revisions were added by this update. Summary of changes: pom.xml| 2 +- .../resource/mapping/PathToUriMappingService.java | 58 +-- .../java/org/apache/sling/api/uri/SlingUri.java| 7 +- .../org/apache/sling/api/uri/SlingUriBuilder.java | 394 - .../org/apache/sling/api/uri/package-info.java | 2 +- .../sling/api/wrappers/impl/MergingValueMap.java | 12 +- .../api/resource/impl/ValueMapUtilMergeTest.java | 19 + .../apache/sling/api/uri/SlingUriBuilderTest.java | 38 ++ .../apache/sling/api/uri/SlingUriEncodingTest.java | 109 ++ .../sling/api/uri/SlingUriInvalidUrisTest.java | 43 ++- .../org/apache/sling/api/uri/SlingUriTest.java | 304 +++- 11 files changed, 849 insertions(+), 139 deletions(-) create mode 100644 src/test/java/org/apache/sling/api/uri/SlingUriEncodingTest.java
[sling-org-apache-sling-api] branch master updated: SLING-9777 unit test for well-known URI
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git The following commit(s) were added to refs/heads/master by this push: new 3e9cf18 SLING-9777 unit test for well-known URI 3e9cf18 is described below commit 3e9cf187eff999235ee161e0543f1d8a68c4285c Author: georg.henzler AuthorDate: Thu Oct 8 23:32:23 2020 +0200 SLING-9777 unit test for well-known URI --- src/test/java/org/apache/sling/api/uri/SlingUriTest.java | 16 1 file changed, 16 insertions(+) diff --git a/src/test/java/org/apache/sling/api/uri/SlingUriTest.java b/src/test/java/org/apache/sling/api/uri/SlingUriTest.java index 6284fb9..f350aec 100644 --- a/src/test/java/org/apache/sling/api/uri/SlingUriTest.java +++ b/src/test/java/org/apache/sling/api/uri/SlingUriTest.java @@ -668,6 +668,22 @@ public class SlingUriTest { } @Test +public void testWellKnownUri() { + +// well-known URIs as specified in https://tools.ietf.org/html/rfc8615 +String dataUrl = "/.well-known/change-password"; + +testUri(dataUrl, true, true, false, false, false, slingUri -> { +assertEquals("/", slingUri.getResourcePath()); +assertEquals(null, slingUri.getSelectorString()); +assertEquals("well-known", slingUri.getExtension()); +assertEquals("/change-password", slingUri.getSuffix()); +assertEquals(null, slingUri.getQuery()); +assertEquals(null, slingUri.getFragment()); +}, asList(resolver, null)); +} + +@Test public void testGetSuffixResource() { Resource expectedSuffixResource = mock(Resource.class); when(resolver.getResource("/suffix/path")).thenReturn(expectedSuffixResource);
[sling-org-apache-sling-api] 01/01: Merge pull request #24 from apache/feature/SLING-9777-SlingUri-better-encoding-handling
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git commit 02088d2a52fa4d7c29f6056dedf776947e3e57e4 Merge: 99af984 8615ff5 Author: Georg Henzler AuthorDate: Thu Oct 8 23:29:02 2020 +0200 Merge pull request #24 from apache/feature/SLING-9777-SlingUri-better-encoding-handling SLING-9777 Better handling for invalid URIs when using SlingUri (special characters, spaces) .../java/org/apache/sling/api/uri/SlingUri.java| 7 +- .../org/apache/sling/api/uri/SlingUriBuilder.java | 394 - .../org/apache/sling/api/uri/package-info.java | 2 +- .../apache/sling/api/uri/SlingUriBuilderTest.java | 38 ++ .../apache/sling/api/uri/SlingUriEncodingTest.java | 109 ++ .../sling/api/uri/SlingUriInvalidUrisTest.java | 43 ++- .../org/apache/sling/api/uri/SlingUriTest.java | 288 ++- 7 files changed, 769 insertions(+), 112 deletions(-)
[sling-org-apache-sling-api] branch master updated (99af984 -> 02088d2)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git. from 99af984 SLING-9774 Use a simpler fix that also passes the tests. add 8615ff5 SLING-9777 Better handling for invalid URIs when using SlingUri (special characters, spaces) new 02088d2 Merge pull request #24 from apache/feature/SLING-9777-SlingUri-better-encoding-handling The 1 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. Summary of changes: .../java/org/apache/sling/api/uri/SlingUri.java| 7 +- .../org/apache/sling/api/uri/SlingUriBuilder.java | 394 - .../org/apache/sling/api/uri/package-info.java | 2 +- .../apache/sling/api/uri/SlingUriBuilderTest.java | 38 ++ .../apache/sling/api/uri/SlingUriEncodingTest.java | 109 ++ .../sling/api/uri/SlingUriInvalidUrisTest.java | 43 ++- .../org/apache/sling/api/uri/SlingUriTest.java | 288 ++- 7 files changed, 769 insertions(+), 112 deletions(-) create mode 100644 src/test/java/org/apache/sling/api/uri/SlingUriEncodingTest.java
[sling-org-apache-sling-api] branch feature/SLING-9777-SlingUri-better-encoding-handling updated (fe0e6fb -> 8615ff5)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9777-SlingUri-better-encoding-handling in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git. discard fe0e6fb SLING-9777 Better handling for invalid URIs when using SlingUri (special characters, spaces) add 8615ff5 SLING-9777 Better handling for invalid URIs when using SlingUri (special characters, spaces) This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (fe0e6fb) \ N -- N -- N refs/heads/feature/SLING-9777-SlingUri-better-encoding-handling (8615ff5) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. No new revisions were added by this update. Summary of changes: .../java/org/apache/sling/api/uri/SlingUri.java| 4 +- .../org/apache/sling/api/uri/SlingUriBuilder.java | 84 .../sling/api/uri/SlingUriInvalidUrisTest.java | 8 +- .../org/apache/sling/api/uri/SlingUriTest.java | 228 - 4 files changed, 279 insertions(+), 45 deletions(-)
[sling-org-apache-sling-api] branch feature/SLING-9777-SlingUri-better-encoding-handling updated (fe0e6fb -> 8615ff5)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9777-SlingUri-better-encoding-handling in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git. discard fe0e6fb SLING-9777 Better handling for invalid URIs when using SlingUri (special characters, spaces) add 8615ff5 SLING-9777 Better handling for invalid URIs when using SlingUri (special characters, spaces) This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (fe0e6fb) \ N -- N -- N refs/heads/feature/SLING-9777-SlingUri-better-encoding-handling (8615ff5) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. No new revisions were added by this update. Summary of changes: .../java/org/apache/sling/api/uri/SlingUri.java| 4 +- .../org/apache/sling/api/uri/SlingUriBuilder.java | 84 .../sling/api/uri/SlingUriInvalidUrisTest.java | 8 +- .../org/apache/sling/api/uri/SlingUriTest.java | 228 - 4 files changed, 279 insertions(+), 45 deletions(-)
[sling-org-apache-sling-api] branch feature/SLING-9777-SlingUri-better-encoding-handling updated (50d11df -> fe0e6fb)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9777-SlingUri-better-encoding-handling in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git. discard 50d11df SLING-9777 Better handling for invalid URIs when using SlingUri (special characters, spaces) add fe0e6fb SLING-9777 Better handling for invalid URIs when using SlingUri (special characters, spaces) This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (50d11df) \ N -- N -- N refs/heads/feature/SLING-9777-SlingUri-better-encoding-handling (fe0e6fb) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. No new revisions were added by this update. Summary of changes: src/main/java/org/apache/sling/api/uri/SlingUriBuilder.java | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-)
[sling-org-apache-sling-api] branch feature/SLING-9777-SlingUri-better-encoding-handling updated (f54999c -> 50d11df)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9777-SlingUri-better-encoding-handling in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git. omit f54999c SLING-9777 Better handling for invalid URIs when using SlingUri (special characters, spaces) add 50d11df SLING-9777 Better handling for invalid URIs when using SlingUri (special characters, spaces) This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (f54999c) \ N -- N -- N refs/heads/feature/SLING-9777-SlingUri-better-encoding-handling (50d11df) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. No new revisions were added by this update. Summary of changes: src/main/java/org/apache/sling/api/uri/package-info.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
[sling-org-apache-sling-api] 01/01: SLING-9777 Better handling for invalid URIs when using SlingUri (special characters, spaces)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch feature/SLING-9777-SlingUri-better-encoding-handling in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git commit f54999cb4c7313cdc871dd8b7788b3a69b0dce2b Author: georg.henzler AuthorDate: Wed Sep 30 20:36:17 2020 +0200 SLING-9777 Better handling for invalid URIs when using SlingUri (special characters, spaces) --- .../java/org/apache/sling/api/uri/SlingUri.java| 7 +- .../org/apache/sling/api/uri/SlingUriBuilder.java | 358 + .../apache/sling/api/uri/SlingUriBuilderTest.java | 38 +++ .../apache/sling/api/uri/SlingUriEncodingTest.java | 109 +++ .../sling/api/uri/SlingUriInvalidUrisTest.java | 37 ++- .../org/apache/sling/api/uri/SlingUriTest.java | 60 +++- 6 files changed, 518 insertions(+), 91 deletions(-) diff --git a/src/main/java/org/apache/sling/api/uri/SlingUri.java b/src/main/java/org/apache/sling/api/uri/SlingUri.java index 2ad757e..2a83417 100644 --- a/src/main/java/org/apache/sling/api/uri/SlingUri.java +++ b/src/main/java/org/apache/sling/api/uri/SlingUri.java @@ -29,9 +29,14 @@ import org.jetbrains.annotations.Nullable; import org.osgi.annotation.versioning.ProviderType; /** + * * Represents an immutable URI in the same way as java.net.URI but is extended with Sling-specific URI parts (e.g. selectors). A SlingUri * usually points to a resource but alternatively, can also contain an opaque URI like {@code mailto:} or {@code javascript:}. Use * {@link SlingUri#adjust(Consumer)} or {@link SlingUriBuilder} to create new or modified Sling URIs. + * + * + * Opposed to {@link URI}, {@code SlingUri} does not make any assumptions regarding URI encoding, a SlingUri can hold URL-encoded or + * non-URL-encoded values for user info, path, query and fragment. * * @since 1.0.0 (Sling API Bundle 2.23.0) */ @@ -97,7 +102,7 @@ public interface SlingUri extends RequestPathInfo { /** * Returns the selector string. * - * @return returns the selector string or null if the URI does not contain selector(s) + * @return returns the selector string or null if the URI does not contain selector(s) (in line with {@link RequestPathInfo}) */ @Override @Nullable diff --git a/src/main/java/org/apache/sling/api/uri/SlingUriBuilder.java b/src/main/java/org/apache/sling/api/uri/SlingUriBuilder.java index 7088672..5522800 100644 --- a/src/main/java/org/apache/sling/api/uri/SlingUriBuilder.java +++ b/src/main/java/org/apache/sling/api/uri/SlingUriBuilder.java @@ -18,8 +18,11 @@ */ package org.apache.sling.api.uri; +import java.io.UnsupportedEncodingException; import java.net.URI; import java.net.URISyntaxException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.Collections; import java.util.Iterator; @@ -68,8 +71,9 @@ public class SlingUriBuilder { private static final String HTTP_SCHEME = "http"; private static final int HTTP_DEFAULT_PORT = 80; -static final char CHAR_HASH = '#'; -static final char CHAR_QM = '?'; +static final String CHAR_HASH = "#"; +static final String CHAR_QM = "?"; +static final char CHAR_AMP = '&'; static final char CHAR_AT = '@'; static final char CHAR_SEMICOLON = ';'; static final char CHAR_EQUALS = '='; @@ -79,6 +83,7 @@ public class SlingUriBuilder { static final String CHAR_SLASH = "/"; static final String SELECTOR_DOT_REGEX = "\\.(?!\\.?/)"; // (?!\\.?/) to avoid matching ./ and ../ static final String PATH_PARAMETERS_REGEX = ";([a-zA-z0-9]+)=(?:\\'([^']*)\\'|([^/]+))"; +static final String BEST_EFFORT_INVALID_URI_MATCHER = "^(?:([^:#@]+):)?(?://(?:([^@#]+)@)?([^/#:]+)(?::([0-9]+))?)?(?:([^?#]+))?(?:\\?([^#]*))?(?:#(.*))?$"; /** * Creates a builder without any URI parameters set. @@ -112,7 +117,7 @@ public class SlingUriBuilder { .setFragment(slingUri.getFragment()) .setSchemeSpecificPart(slingUri.isOpaque() ? slingUri.getSchemeSpecificPart() : null) .setResourceResolver(slingUri instanceof ImmutableSlingUri -? ((ImmutableSlingUri) slingUri).getBuilder().resourceResolver +? ((ImmutableSlingUri) slingUri).getData().resourceResolver : null); } @@ -172,19 +177,20 @@ public class SlingUriBuilder { */ @NotNull public static SlingUriBuilder createFrom(@NotNull URI uri, @Nullable ResourceResolver resourceResolver) { -String path = uri.getPath(); +String path = uri.getRawPath(); boolean pathExists = isNotBlank(path); -boolean schemeSpecificRelevant = !pathExis
[sling-org-apache-sling-api] branch feature/SLING-9777-SlingUri-better-encoding-handling created (now f54999c)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9777-SlingUri-better-encoding-handling in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git. at f54999c SLING-9777 Better handling for invalid URIs when using SlingUri (special characters, spaces) This branch includes the following new commits: new f54999c SLING-9777 Better handling for invalid URIs when using SlingUri (special characters, spaces) The 1 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.
[sling-org-apache-sling-resourceresolver] 01/01: SLING-9662 Introduce Resource Mapping SPI
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git commit 4ab43acf49dfd9cd25119b74054980b3c4144918 Author: georg.henzler AuthorDate: Fri Aug 14 07:36:58 2020 +0200 SLING-9662 Introduce Resource Mapping SPI --- pom.xml| 2 +- .../impl/CommonResourceResolverFactoryImpl.java| 9 +- .../impl/ResourceResolverFactoryActivator.java | 9 + .../impl/ResourceResolverImpl.java | 7 +- .../impl/mapping/ResourceMapperImpl.java | 23 ++- .../urimapping/MappingChainContextInternal.java| 71 +++ .../impl/urimapping/MappingChainResult.java| 45 .../urimapping/PathToUriMappingServiceImpl.java| 226 + .../impl/EtcMappingResourceResolverTest.java | 56 ++--- .../impl/MockedResourceResolverImplTest.java | 9 +- .../resourceresolver/impl/ProviderHandlerTest.java | 2 + .../impl/ResourceDecoratorTestBase.java| 7 + .../impl/ResourceResolverImplTest.java | 2 + .../impl/ResourceResolverMangleNamespacesTest.java | 11 +- .../mapping/AbstractMappingMapEntriesTest.java | 51 ++--- .../impl/mapping/EtcMappingMapEntriesTest.java | 38 ++-- .../impl/mapping/ResourceMapperImplTest.java | 3 + .../sling/resourceresolver/util/MockTestUtil.java | 42 ++-- .../util/TestPathToUriMappingService.java | 59 ++ 19 files changed, 571 insertions(+), 101 deletions(-) diff --git a/pom.xml b/pom.xml index b056ab6..c93f046 100644 --- a/pom.xml +++ b/pom.xml @@ -106,7 +106,7 @@ org.apache.sling org.apache.sling.api -2.21.0 +2.23.1-SNAPSHOT provided diff --git a/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java b/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java index b925e65..4e423c2 100644 --- a/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java +++ b/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java @@ -31,12 +31,11 @@ import java.util.Stack; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicBoolean; -import org.jetbrains.annotations.NotNull; - import org.apache.commons.collections4.BidiMap; import org.apache.sling.api.resource.LoginException; import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.mapping.PathToUriMappingService; import org.apache.sling.api.resource.path.Path; import org.apache.sling.resourceresolver.impl.console.ResourceResolverWebConsolePlugin; import org.apache.sling.resourceresolver.impl.helper.ResourceDecoratorTracker; @@ -48,6 +47,7 @@ import org.apache.sling.resourceresolver.impl.mapping.Mapping; import org.apache.sling.resourceresolver.impl.providers.ResourceProviderTracker; import org.apache.sling.serviceusermapping.ServiceUserMapper; import org.apache.sling.spi.resource.provider.ResourceProvider; +import org.jetbrains.annotations.NotNull; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.slf4j.Logger; @@ -405,6 +405,11 @@ public class CommonResourceResolverFactoryImpl implements ResourceResolverFactor return this.activator.getResourceAccessSecurityTracker(); } +/** gets PathToUriMappingServiceImpl */ +public PathToUriMappingService getPathToUriMappingService() { +return this.activator.getPathToUriMappingService(); +} + @NotNull @Override public ResourceResolver getServiceResourceResolver( diff --git a/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java b/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java index 646a077..6de579a 100644 --- a/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java +++ b/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java @@ -34,9 +34,11 @@ import org.apache.commons.collections4.BidiMap; import org.apache.commons.collections4.bidimap.TreeBidiMap; import org.apache.sling.api.resource.ResourceDecorator; import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.mapping.PathToUriMappingService; import org.apache.sling.api.resource.path.Path; import org.apache.sling.api.resource.runtime.RuntimeService; import org.apache.sling.resourceresolver.impl.helper.ResourceDecoratorTracker; +import org.apache.sling.resourceresolver.impl.mapping.MapEntries; import
[sling-org-apache-sling-engine] branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 updated (7f1e391 -> 666e3f2)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-engine.git. omit 7f1e391 SLING-9662 Use SlingUri as provided in request from auth.core new 666e3f2 SLING-9662 Use SlingUri as provided in request from auth.core This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (7f1e391) \ N -- N -- N refs/heads/feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 (666e3f2) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. The 1 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. Summary of changes: pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
[sling-org-apache-sling-resourceresolver] branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 updated (a827610 -> 4ab43ac)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git. omit a827610 SLING-9662 Introduce Resource Mapping SPI new 4ab43ac SLING-9662 Introduce Resource Mapping SPI This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (a827610) \ N -- N -- N refs/heads/feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 (4ab43ac) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. The 1 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. Summary of changes: pom.xml| 2 +- .../urimapping/defaultmappers/BasePathMapper.java | 84 -- .../defaultmappers/EnsureHtmlExtensionMapper.java | 80 - 3 files changed, 1 insertion(+), 165 deletions(-) delete mode 100644 src/main/java/org/apache/sling/resourceresolver/impl/urimapping/defaultmappers/BasePathMapper.java delete mode 100644 src/main/java/org/apache/sling/resourceresolver/impl/urimapping/defaultmappers/EnsureHtmlExtensionMapper.java
[sling-org-apache-sling-engine] 01/01: SLING-9662 Use SlingUri as provided in request from auth.core
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-engine.git commit 666e3f2e0728eaf483eee7ef3c6b1be822de5d2e Author: georg.henzler AuthorDate: Mon Sep 21 17:13:00 2020 +0200 SLING-9662 Use SlingUri as provided in request from auth.core --- pom.xml| 4 +-- .../sling/engine/impl/request/RequestData.java | 38 -- .../engine/impl/request/InitResourceTest.java | 22 + 3 files changed, 37 insertions(+), 27 deletions(-) diff --git a/pom.xml b/pom.xml index 83d0419..be00e1f 100644 --- a/pom.xml +++ b/pom.xml @@ -111,7 +111,7 @@ org.apache.sling org.apache.sling.api -2.6.0 +2.23.1-SNAPSHOT provided @@ -123,7 +123,7 @@ org.apache.sling org.apache.sling.auth.core -1.0.0 +1.5.1-SNAPSHOT provided diff --git a/src/main/java/org/apache/sling/engine/impl/request/RequestData.java b/src/main/java/org/apache/sling/engine/impl/request/RequestData.java index 379eb83..b73a166 100644 --- a/src/main/java/org/apache/sling/engine/impl/request/RequestData.java +++ b/src/main/java/org/apache/sling/engine/impl/request/RequestData.java @@ -23,7 +23,6 @@ import static org.apache.sling.api.SlingConstants.SLING_CURRENT_SERVLET_NAME; import java.io.BufferedReader; import java.io.IOException; import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; import java.util.ArrayList; import javax.servlet.Servlet; @@ -46,8 +45,10 @@ import org.apache.sling.api.request.TooManyCallsException; import org.apache.sling.api.resource.Resource; import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.api.servlets.ServletResolver; +import org.apache.sling.api.uri.SlingUri; import org.apache.sling.api.wrappers.SlingHttpServletRequestWrapper; import org.apache.sling.api.wrappers.SlingHttpServletResponseWrapper; +import org.apache.sling.auth.core.AuthenticationSupport; import org.apache.sling.engine.impl.SlingHttpServletRequestImpl; import org.apache.sling.engine.impl.SlingHttpServletResponseImpl; import org.apache.sling.engine.impl.SlingMainServlet; @@ -213,8 +214,7 @@ public class RequestData { this.servletResponse = response; this.slingRequest = getSlingHttpServletRequestFactory().createRequest(this, this.servletRequest); -this.slingResponse = new SlingHttpServletResponseImpl(this, -servletResponse); +this.slingResponse = new SlingHttpServletResponseImpl(this, servletResponse); // Getting the RequestProgressTracker from the request attributes like // this should not be generally used, it's just a way to pass it from @@ -237,19 +237,17 @@ public class RequestData { requestProgressTracker.startTimer("ResourceResolution"); final SlingHttpServletRequest request = getSlingRequest(); -StringBuffer requestURL = servletRequest.getRequestURL(); -String path = request.getPathInfo(); -if (requestURL.indexOf(";") > -1 && !path.contains(";")) { -final String decodedURL; -try { -decodedURL = URLDecoder.decode(requestURL.toString(), "UTF-8"); -} catch (UnsupportedEncodingException e) { -throw new AssertionError("UTF-8 encoding is not supported"); -} -path = path.concat(decodedURL.substring(decodedURL.indexOf(';'))); +// Set by o.a.s.auth.core bundle +SlingUri slingUri = (SlingUri) request.getAttribute(AuthenticationSupport.REQUEST_ATTRIBUTE_URI); +if (slingUri == null) { +throw new IllegalStateException( +"SlingUri not available as attribute of request (expected to be set in bundle o.a.s.auth.core)"); } +// ensure slingUri is bound to correct resource resolver +slingUri = slingUri.adjust(b -> b.setResourceResolver(resourceResolver)); +request.setAttribute(AuthenticationSupport.REQUEST_ATTRIBUTE_URI, slingUri); -Resource resource = resourceResolver.resolve(request, path); +Resource resource = resourceResolver.resolve(request, slingUri.getPath()); if (request.getAttribute(REQUEST_RESOURCE_PATH_ATTR) == null) { request.setAttribute(REQUEST_RESOURCE_PATH_ATTR, resource.getPath()); } @@ -262,10 +260,14 @@ public class RequestData { public void initServlet(final Resource resource, final ServletResolver sr) { // the resource and the request path info, will never be null -RequestPathInfo requestPat
[sling-org-apache-sling-api] 01/01: SLING-9745 Sling Uri Mapping SPI
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git commit f149adc88030a394fa7fb693fd1442fdf1b0680e Author: georg.henzler AuthorDate: Tue Sep 22 08:47:59 2020 +0200 SLING-9745 Sling Uri Mapping SPI --- .../resource/mapping/PathToUriMappingService.java | 77 ++ .../sling/api/resource/mapping/package-info.java | 2 +- .../sling/spi/urimapping/MappingChainContext.java | 65 ++ .../sling/spi/urimapping/SlingUriMapper.java | 66 +++ .../mapping => spi/urimapping}/package-info.java | 4 +- 5 files changed, 211 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java b/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java new file mode 100644 index 000..20e45c2 --- /dev/null +++ b/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java @@ -0,0 +1,77 @@ +/* + * 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.api.resource.mapping; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.sling.api.uri.SlingUri; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.osgi.annotation.versioning.ProviderType; + +/** + * Provides a way to resolve and map paths to Sling URIs. Both operations are extensible by + * {@link org.apache.sling.spi.urimapping.SlingUriMapper} OSGi services. + * + * @since 1.1.0 (Sling API Bundle 2.23.0) + */ +@ProviderType +public interface PathToUriMappingService { + +/** The result of a map or resolve operation */ +@ProviderType +public interface Result { +/** + * The Sling URI as result of the resolve or map operation. + * + * @return the Sling URI + */ +@NotNull +SlingUri getUri(); + +/** + * Returns all intermediate mappings as produced by {@link org.apache.sling.spi.urimapping.SlingUriMapper} services + * + * @return the intermediate mappings + */ +@NotNull +Map getIntermediateMappings(); +} + +/** + * Maps a path to a Sling URI. + * + * @param referenceRequest the reference request with the same properties as the actual request that will have to resolve the produced + *URI. + * @param unmappedPath the path that is not mapped yet (may or may not contain selector, extension and suffix) + * @return a @{link PathToUriMappingService.Result} + */ +Result map(@Nullable HttpServletRequest referenceRequest, @NotNull String unmappedPath); + +/** + * Resolves a path relative to the given request. + * + * @param request the request + * @param path the path to be resolved or null for which case the information from request is used + * @return a @{link PathToUriMappingService.Result} + */ +Result resolve(@Nullable HttpServletRequest request, @Nullable String path); +} \ No newline at end of file diff --git a/src/main/java/org/apache/sling/api/resource/mapping/package-info.java b/src/main/java/org/apache/sling/api/resource/mapping/package-info.java index e871225..00a1ea1 100644 --- a/src/main/java/org/apache/sling/api/resource/mapping/package-info.java +++ b/src/main/java/org/apache/sling/api/resource/mapping/package-info.java @@ -17,7 +17,7 @@ * under the License. */ -@Version("1.0.1") +@Version("1.1.0") package org.apache.sling.api.resource.mapping; import org.osgi.annotation.versioning.Version; diff --git a/src/main/java/org/apache/sling/spi/urimapping/MappingChainContext.java b/src/main/java/org/apache/sling/spi/urimapping/MappingChainContext.java new file mode 100644 index 000..6f65aa9 --- /dev/null +++ b/src/main/java/org/apache/sling/spi/urimapping/MappingChainContext.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contribut
[sling-org-apache-sling-auth-core] branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 updated (64326ae -> b4cc92c)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-auth-core.git. discard 64326ae SLING-9662 Use PathToUriMappingService to pre-process path before authentication new b4cc92c SLING-9662 Use PathToUriMappingService to pre-process path before authentication This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (64326ae) \ N -- N -- N refs/heads/feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 (b4cc92c) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. The 1 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. Summary of changes: pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
[sling-org-apache-sling-auth-core] 01/01: SLING-9662 Use PathToUriMappingService to pre-process path before authentication
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-auth-core.git commit b4cc92c962571daf6a77d9ec63c9f0609f2c1465 Author: georg.henzler AuthorDate: Mon Sep 21 10:44:56 2020 +0200 SLING-9662 Use PathToUriMappingService to pre-process path before authentication --- pom.xml| 2 +- .../sling/auth/core/AuthenticationSupport.java | 8 +++ .../sling/auth/core/impl/SlingAuthenticator.java | 33 +- .../org/apache/sling/auth/core/package-info.java | 4 +- .../auth/core/impl/SlingAuthenticatorTest.java | 77 ++ 5 files changed, 64 insertions(+), 60 deletions(-) diff --git a/pom.xml b/pom.xml index fb78d39..bf74525 100644 --- a/pom.xml +++ b/pom.xml @@ -71,7 +71,7 @@ org.apache.sling org.apache.sling.api -2.20.0 +2.23.1-SNAPSHOT provided diff --git a/src/main/java/org/apache/sling/auth/core/AuthenticationSupport.java b/src/main/java/org/apache/sling/auth/core/AuthenticationSupport.java index 7257110..0f2dd4d 100644 --- a/src/main/java/org/apache/sling/auth/core/AuthenticationSupport.java +++ b/src/main/java/org/apache/sling/auth/core/AuthenticationSupport.java @@ -85,6 +85,14 @@ public interface AuthenticationSupport { static final String REQUEST_ATTRIBUTE_RESOLVER = "org.apache.sling.auth.core.ResourceResolver"; /** + * The name of the request attribute set by the {@link #handleSecurity(HttpServletRequest, HttpServletResponse)} method for the request + * URI that was resolved already. + * + * The request attribute is set to a Sling SlingUri as provided by PathToUriMappingService.resolve(). + */ +static final String REQUEST_ATTRIBUTE_URI = "org.apache.sling.auth.core.SlingUri"; + +/** * The name of the request parameter indicating where to redirect to after * successful authentication (and optional impersonation). This parameter is * respected if either anonymous authentication or regular authentication diff --git a/src/main/java/org/apache/sling/auth/core/impl/SlingAuthenticator.java b/src/main/java/org/apache/sling/auth/core/impl/SlingAuthenticator.java index 6e203cc..0f2054a 100644 --- a/src/main/java/org/apache/sling/auth/core/impl/SlingAuthenticator.java +++ b/src/main/java/org/apache/sling/auth/core/impl/SlingAuthenticator.java @@ -50,6 +50,8 @@ import org.apache.sling.api.auth.NoAuthenticationHandlerException; import org.apache.sling.api.resource.LoginException; import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.mapping.PathToUriMappingService; +import org.apache.sling.api.uri.SlingUri; import org.apache.sling.auth.core.AuthConstants; import org.apache.sling.auth.core.AuthUtil; import org.apache.sling.auth.core.AuthenticationSupport; @@ -260,6 +262,9 @@ public class SlingAuthenticator implements Authenticator, @Reference private ResourceResolverFactory resourceResolverFactory; +@Reference +private PathToUriMappingService pathToUriMappingService; + private PathBasedHolderCache authHandlerCache = new PathBasedHolderCache(); // package protected for access in inner class ... @@ -506,7 +511,7 @@ public class SlingAuthenticator implements Authenticator, private boolean doHandleSecurity(HttpServletRequest request, HttpServletResponse response) { -// 0. Check for request attribute; set if not present +// 0 Check for request attribute; set if not present Object authUriSufficesAttr = request .getAttribute(AuthConstants.ATTR_REQUEST_AUTH_URI_SUFFIX); if (authUriSufficesAttr == null && authUriSuffices != null) { @@ -747,22 +752,18 @@ public class SlingAuthenticator implements Authenticator, * @return The path */ private String getPath(final HttpServletRequest request) { -final StringBuilder sb = new StringBuilder(); -if (request.getServletPath() != null) { -sb.append(request.getServletPath()); -} -if (request.getPathInfo() != null) { -sb.append(request.getPathInfo()); -} -String path = sb.toString(); -// Get the path used to select the authenticator, if the SlingServlet -// itself has been requested without any more info, this will be empty -// and we assume the root (SLING-722) -if (path.length() == 0) { -path = "/"; -} -return path; +// this method is safely called from all three public entry points (that is handleSecurity(), login(), logout()) +// for all execution paths +
[sling-org-apache-sling-api] branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 updated (0ad91c2 -> f149adc)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git. discard 0ad91c2 SLING-9745 Sling Uri Mapping SPI add 7fcb6ca [maven-release-plugin] prepare release org.apache.sling.api-2.23.0 add 36307d3 [maven-release-plugin] prepare for next development iteration new f149adc SLING-9745 Sling Uri Mapping SPI This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (0ad91c2) \ N -- N -- N refs/heads/feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 (f149adc) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. The 1 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. Summary of changes: pom.xml | 4 ++-- src/main/java/org/apache/sling/spi/urimapping/SlingUriMapper.java | 8 +++- 2 files changed, 5 insertions(+), 7 deletions(-)
[sling-site] branch master updated: Update site with Release of Sling API 2.23.0
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-site.git The following commit(s) were added to refs/heads/master by this push: new e422f5e Update site with Release of Sling API 2.23.0 e422f5e is described below commit e422f5eaa47db107d1b4dfcc3aade8fd8cb179fe Author: georg.henzler AuthorDate: Sat Sep 26 23:33:31 2020 +0200 Update site with Release of Sling API 2.23.0 --- src/main/jbake/content/releases.md | 1 + src/main/jbake/templates/downloads.tpl | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/jbake/content/releases.md b/src/main/jbake/content/releases.md index 0e2fbd1..f3cbc37 100644 --- a/src/main/jbake/content/releases.md +++ b/src/main/jbake/content/releases.md @@ -8,6 +8,7 @@ This is a list of all our releases, available from our [downloads](/downloads.cg ## September 2020 +* Sling API 2.23.0 (26th) * Sling Kickstart Project 0.0.8, Sling Kickstart Maven Plugin 0.0.8 (23rd) * JCR Oak Server 1.2.8 (14th) * Testing Sling Mock 2.6.2, OSGi Feature Maven Plugin 1.3.16, Feature Model Launcher 1.1.6, Feature Model 1.2.8, Content-Package to Feature Model Converter 1.0.14 (14th) diff --git a/src/main/jbake/templates/downloads.tpl b/src/main/jbake/templates/downloads.tpl index bed4ff3..7ee0c31 100644 --- a/src/main/jbake/templates/downloads.tpl +++ b/src/main/jbake/templates/downloads.tpl @@ -51,7 +51,7 @@ def bndPlugins=[ def bundles=[ "Adapter|org.apache.sling.adapter|2.1.10|Y|jar", "Adapter Annotations|adapter-annotations|1.0.0|Y|jar", - "API|org.apache.sling.api|2.22.0|Y|jar", + "API|org.apache.sling.api|2.23.0|Y|jar", "Auth Core|org.apache.sling.auth.core|1.5.0|Y|jar", "Form Based Authentication|org.apache.sling.auth.form|1.0.20|Y|jar", "Authentication XING API|org.apache.sling.auth.xing.api|0.0.2|Y|jar",
svn commit: r41595 - /release/sling/
Author: ghenzler Date: Sat Sep 26 20:56:42 2020 New Revision: 41595 Log: Release Sling API 2.23.0 Added: release/sling/org.apache.sling.api-2.23.0-javadoc.jar (with props) release/sling/org.apache.sling.api-2.23.0-javadoc.jar.asc release/sling/org.apache.sling.api-2.23.0-javadoc.jar.md5 release/sling/org.apache.sling.api-2.23.0-javadoc.jar.sha1 release/sling/org.apache.sling.api-2.23.0-source-release.zip (with props) release/sling/org.apache.sling.api-2.23.0-source-release.zip.asc release/sling/org.apache.sling.api-2.23.0-source-release.zip.md5 release/sling/org.apache.sling.api-2.23.0-source-release.zip.sha1 release/sling/org.apache.sling.api-2.23.0-sources.jar (with props) release/sling/org.apache.sling.api-2.23.0-sources.jar.asc release/sling/org.apache.sling.api-2.23.0-sources.jar.md5 release/sling/org.apache.sling.api-2.23.0-sources.jar.sha1 release/sling/org.apache.sling.api-2.23.0.jar (with props) release/sling/org.apache.sling.api-2.23.0.jar.asc release/sling/org.apache.sling.api-2.23.0.jar.md5 release/sling/org.apache.sling.api-2.23.0.jar.sha1 release/sling/org.apache.sling.api-2.23.0.pom release/sling/org.apache.sling.api-2.23.0.pom.asc release/sling/org.apache.sling.api-2.23.0.pom.md5 release/sling/org.apache.sling.api-2.23.0.pom.sha1 Added: release/sling/org.apache.sling.api-2.23.0-javadoc.jar == Binary file - no diff available. Propchange: release/sling/org.apache.sling.api-2.23.0-javadoc.jar -- svn:mime-type = application/octet-stream Added: release/sling/org.apache.sling.api-2.23.0-javadoc.jar.asc == --- release/sling/org.apache.sling.api-2.23.0-javadoc.jar.asc (added) +++ release/sling/org.apache.sling.api-2.23.0-javadoc.jar.asc Sat Sep 26 20:56:42 2020 @@ -0,0 +1,11 @@ +-BEGIN PGP SIGNATURE- + +iQEzBAABCgAdFiEENEVu0wmA6tl2+lDjPH3vfWpCszMFAl9rmWMACgkQPH3vfWpC +szMeIwf9Gjgbh6AmpVnv7DbP8wuCm7XieJM3mld0AUj/aG1wcwtycb0c2avmmD/+ +ES14dRRoxrDEd7OGzLk5v9U5+v3up8B2csr9isijRV1dNqThvln24ruX3IosGz5n +MUXOrfxQ49xc82vWbmPmavOyzOquhKSAzrWvVpaUDB8VU/Y/jlyC8m8T5CHew0GU +8E0JPmAi7iitvamYxCPD9WbpU2c8bLAHAVW5DWIqMkAv8cNdMgy2uaAKTO5JbvDg +WXtcV0wxj8+BTu/jYs+kwgkW+gZtKMry7doMtr7gxbLvpYr1st82YXJunODtlTM+ +GkxuAmj6HWG8gYNgYnPPow5aGVCoxw== +=BsET +-END PGP SIGNATURE- Added: release/sling/org.apache.sling.api-2.23.0-javadoc.jar.md5 == --- release/sling/org.apache.sling.api-2.23.0-javadoc.jar.md5 (added) +++ release/sling/org.apache.sling.api-2.23.0-javadoc.jar.md5 Sat Sep 26 20:56:42 2020 @@ -0,0 +1 @@ +21cf551c730c72caa9070a579410e119 \ No newline at end of file Added: release/sling/org.apache.sling.api-2.23.0-javadoc.jar.sha1 == --- release/sling/org.apache.sling.api-2.23.0-javadoc.jar.sha1 (added) +++ release/sling/org.apache.sling.api-2.23.0-javadoc.jar.sha1 Sat Sep 26 20:56:42 2020 @@ -0,0 +1 @@ +91c129b47b32554846cefefcf4ff2a8c83ab7cd6 \ No newline at end of file Added: release/sling/org.apache.sling.api-2.23.0-source-release.zip == Binary file - no diff available. Propchange: release/sling/org.apache.sling.api-2.23.0-source-release.zip -- svn:mime-type = application/octet-stream Added: release/sling/org.apache.sling.api-2.23.0-source-release.zip.asc == --- release/sling/org.apache.sling.api-2.23.0-source-release.zip.asc (added) +++ release/sling/org.apache.sling.api-2.23.0-source-release.zip.asc Sat Sep 26 20:56:42 2020 @@ -0,0 +1,11 @@ +-BEGIN PGP SIGNATURE- + +iQEzBAABCgAdFiEENEVu0wmA6tl2+lDjPH3vfWpCszMFAl9rmWMACgkQPH3vfWpC +szMZfQgAuKNwq1SNC/A41RMmUN0LpaHSaiUGWVWdWCODdCZt6zwgdqGARtkQ1R4H +uZGQgAdVDvP/qx2ZfY6u9JKyhF5Z3KFcmBXoT21jE8SxdtYgqRNMpaPqoj8Be+Ze +jM373SdKsjD+mN7bLEnx+pvjpjWgirkmqgay4bLHNBC+y3JakAnY4E2Ixst2Y8An +FyXuYpbC/DHKX3L3x9aJL2vf1Tqid1LCIkuKt3pr5TM3lK1pWJ9/tigjIo+UCeuZ +70n1NpQ+WffXOeSC7109/Ru8ikt4sZ6xwkVasIR40a5PuYHVsTYFHAjBre2/PpSs +NmOTo5UwSAg0gKsmRYxzJM7cB0slBA== +=lSc6 +-END PGP SIGNATURE- Added: release/sling/org.apache.sling.api-2.23.0-source-release.zip.md5 == --- release/sling/org.apache.sling.api-2.23.0-source-release.zip.md5 (added) +++ release/sling/org.apache.sling.api-2.23.0-source-release.zip.md5 Sat Sep 26 20:56:42 2020 @@ -0,0 +1 @@ +a2b4cc7db41ca46c31c935d9f2ed668c \ No newline at end of file Added: release/sling/org.apache.sling.api-2.23.0-source
svn commit: r41594 - /release/sling/
Author: ghenzler Date: Sat Sep 26 20:55:27 2020 New Revision: 41594 Log: Removing previous release Sling API 2.22.0 Removed: release/sling/org.apache.sling.api-2.22.0-javadoc.jar release/sling/org.apache.sling.api-2.22.0-javadoc.jar.asc release/sling/org.apache.sling.api-2.22.0-javadoc.jar.md5 release/sling/org.apache.sling.api-2.22.0-javadoc.jar.sha1 release/sling/org.apache.sling.api-2.22.0-source-release.zip release/sling/org.apache.sling.api-2.22.0-source-release.zip.asc release/sling/org.apache.sling.api-2.22.0-source-release.zip.md5 release/sling/org.apache.sling.api-2.22.0-source-release.zip.sha1 release/sling/org.apache.sling.api-2.22.0-sources.jar release/sling/org.apache.sling.api-2.22.0-sources.jar.asc release/sling/org.apache.sling.api-2.22.0-sources.jar.md5 release/sling/org.apache.sling.api-2.22.0-sources.jar.sha1 release/sling/org.apache.sling.api-2.22.0.jar release/sling/org.apache.sling.api-2.22.0.jar.asc release/sling/org.apache.sling.api-2.22.0.jar.md5 release/sling/org.apache.sling.api-2.22.0.jar.sha1 release/sling/org.apache.sling.api-2.22.0.pom release/sling/org.apache.sling.api-2.22.0.pom.asc release/sling/org.apache.sling.api-2.22.0.pom.md5 release/sling/org.apache.sling.api-2.22.0.pom.sha1
[sling-org-apache-sling-api] branch master updated: [maven-release-plugin] prepare release org.apache.sling.api-2.23.0
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git The following commit(s) were added to refs/heads/master by this push: new 7fcb6ca [maven-release-plugin] prepare release org.apache.sling.api-2.23.0 7fcb6ca is described below commit 7fcb6cae9ab994b9fb29351ddcb859b8f98236e1 Author: georg.henzler AuthorDate: Wed Sep 23 20:51:24 2020 +0200 [maven-release-plugin] prepare release org.apache.sling.api-2.23.0 --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 8e02cb7..107903e 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ org.apache.sling.api -2.23.0-SNAPSHOT +2.23.0 Apache Sling API @@ -46,13 +46,13 @@ scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git https://gitbox.apache.org/repos/asf?p=sling-org-apache-sling-api.git - HEAD + org.apache.sling.api-2.23.0 12314252 8 - 2019-10-02T08:04:00Z + 2020-09-23T18:50:54Z
[sling-org-apache-sling-api] annotated tag org.apache.sling.api-2.23.0 created (now 00f3c8b)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to annotated tag org.apache.sling.api-2.23.0 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git. at 00f3c8b (tag) tagging 7fcb6cae9ab994b9fb29351ddcb859b8f98236e1 (commit) replaces org.apache.sling.api-2.22.0 by georg.henzler on Wed Sep 23 20:51:30 2020 +0200 - Log - [maven-release-plugin] copy for tag org.apache.sling.api-2.23.0 --- No new revisions were added by this update.
[sling-org-apache-sling-api] branch master updated: [maven-release-plugin] prepare for next development iteration
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git The following commit(s) were added to refs/heads/master by this push: new 36307d3 [maven-release-plugin] prepare for next development iteration 36307d3 is described below commit 36307d362fcd4b20c3d3386af4083a7e81836cef Author: georg.henzler AuthorDate: Wed Sep 23 20:51:35 2020 +0200 [maven-release-plugin] prepare for next development iteration --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 107903e..36cd97d 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ org.apache.sling.api -2.23.0 +2.23.1-SNAPSHOT Apache Sling API @@ -46,13 +46,13 @@ scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git https://gitbox.apache.org/repos/asf?p=sling-org-apache-sling-api.git - org.apache.sling.api-2.23.0 + HEAD 12314252 8 - 2020-09-23T18:50:54Z + 2020-09-23T18:51:35Z
[sling-org-apache-sling-api] branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 updated (415ec0d -> 0ad91c2)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git. discard 415ec0d SLING-9745 Sling Uri Mapping SPI add e78f68f SLING-7510 : UriProvider throws unchecked IllegalArgumentException that must be handled by consumers add 8e6f6c3 SLING-9745 Handle absolute URIs without scheme correctly new 0ad91c2 SLING-9745 Sling Uri Mapping SPI This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (415ec0d) \ N -- N -- N refs/heads/feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 (0ad91c2) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. The 1 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. Summary of changes: .../external/ExternalizableInputStream.java| 4 ++- .../sling/api/resource/external/URIProvider.java | 9 ++--- .../sling/api/resource/external/package-info.java | 2 +- .../org/apache/sling/api/uri/SlingUriBuilder.java | 30 .../org/apache/sling/api/uri/SlingUriTest.java | 40 ++ 5 files changed, 63 insertions(+), 22 deletions(-)
[sling-org-apache-sling-api] 01/01: SLING-9745 Sling Uri Mapping SPI
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git commit 0ad91c258bb985839eefc93ee98692c62aff201c Author: georg.henzler AuthorDate: Tue Sep 22 08:47:59 2020 +0200 SLING-9745 Sling Uri Mapping SPI --- .../resource/mapping/PathToUriMappingService.java | 77 ++ .../sling/api/resource/mapping/package-info.java | 2 +- .../sling/spi/urimapping/MappingChainContext.java | 65 ++ .../sling/spi/urimapping/SlingUriMapper.java | 68 +++ .../mapping => spi/urimapping}/package-info.java | 4 +- 5 files changed, 213 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java b/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java new file mode 100644 index 000..20e45c2 --- /dev/null +++ b/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java @@ -0,0 +1,77 @@ +/* + * 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.api.resource.mapping; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.sling.api.uri.SlingUri; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.osgi.annotation.versioning.ProviderType; + +/** + * Provides a way to resolve and map paths to Sling URIs. Both operations are extensible by + * {@link org.apache.sling.spi.urimapping.SlingUriMapper} OSGi services. + * + * @since 1.1.0 (Sling API Bundle 2.23.0) + */ +@ProviderType +public interface PathToUriMappingService { + +/** The result of a map or resolve operation */ +@ProviderType +public interface Result { +/** + * The Sling URI as result of the resolve or map operation. + * + * @return the Sling URI + */ +@NotNull +SlingUri getUri(); + +/** + * Returns all intermediate mappings as produced by {@link org.apache.sling.spi.urimapping.SlingUriMapper} services + * + * @return the intermediate mappings + */ +@NotNull +Map getIntermediateMappings(); +} + +/** + * Maps a path to a Sling URI. + * + * @param referenceRequest the reference request with the same properties as the actual request that will have to resolve the produced + *URI. + * @param unmappedPath the path that is not mapped yet (may or may not contain selector, extension and suffix) + * @return a @{link PathToUriMappingService.Result} + */ +Result map(@Nullable HttpServletRequest referenceRequest, @NotNull String unmappedPath); + +/** + * Resolves a path relative to the given request. + * + * @param request the request + * @param path the path to be resolved or null for which case the information from request is used + * @return a @{link PathToUriMappingService.Result} + */ +Result resolve(@Nullable HttpServletRequest request, @Nullable String path); +} \ No newline at end of file diff --git a/src/main/java/org/apache/sling/api/resource/mapping/package-info.java b/src/main/java/org/apache/sling/api/resource/mapping/package-info.java index e871225..00a1ea1 100644 --- a/src/main/java/org/apache/sling/api/resource/mapping/package-info.java +++ b/src/main/java/org/apache/sling/api/resource/mapping/package-info.java @@ -17,7 +17,7 @@ * under the License. */ -@Version("1.0.1") +@Version("1.1.0") package org.apache.sling.api.resource.mapping; import org.osgi.annotation.versioning.Version; diff --git a/src/main/java/org/apache/sling/spi/urimapping/MappingChainContext.java b/src/main/java/org/apache/sling/spi/urimapping/MappingChainContext.java new file mode 100644 index 000..6f65aa9 --- /dev/null +++ b/src/main/java/org/apache/sling/spi/urimapping/MappingChainContext.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contribut
[sling-org-apache-sling-api] branch master updated: SLING-9745 Handle absolute URIs without scheme correctly
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git The following commit(s) were added to refs/heads/master by this push: new 8e6f6c3 SLING-9745 Handle absolute URIs without scheme correctly 8e6f6c3 is described below commit 8e6f6c3e19b86d9cf0b0647a9ab8af1c0f094bb0 Author: georg.henzler AuthorDate: Wed Sep 23 20:39:56 2020 +0200 SLING-9745 Handle absolute URIs without scheme correctly --- .../org/apache/sling/api/uri/SlingUriBuilder.java | 30 .../org/apache/sling/api/uri/SlingUriTest.java | 40 ++ 2 files changed, 54 insertions(+), 16 deletions(-) diff --git a/src/main/java/org/apache/sling/api/uri/SlingUriBuilder.java b/src/main/java/org/apache/sling/api/uri/SlingUriBuilder.java index 29ef397..7088672 100644 --- a/src/main/java/org/apache/sling/api/uri/SlingUriBuilder.java +++ b/src/main/java/org/apache/sling/api/uri/SlingUriBuilder.java @@ -657,23 +657,21 @@ public class SlingUriBuilder { private String toStringInternal(boolean includeScheme, boolean includeFragment) { StringBuilder requestUri = new StringBuilder(); - -if (isAbsolute()) { -if (includeScheme) { -requestUri.append(scheme + CHAR_COLON); + +if (includeScheme && isAbsolute()) { +requestUri.append(scheme + CHAR_COLON); +} +if (isNotBlank(host)) { +requestUri.append(CHAR_SLASH + CHAR_SLASH); +if (isNotBlank(userInfo)) { +requestUri.append(userInfo + CHAR_AT); } -if (schemeSpecificPart == null) { -requestUri.append(CHAR_SLASH + CHAR_SLASH); -if (isNotBlank(userInfo)) { -requestUri.append(userInfo + CHAR_AT); -} -requestUri.append(host); -if (port > 0 -&& !(scheme.equals(HTTP_SCHEME) && port == HTTP_DEFAULT_PORT) -&& !(scheme.equals(HTTPS_SCHEME) && port == HTTPS_DEFAULT_PORT)) { -requestUri.append(CHAR_COLON); -requestUri.append(port); -} +requestUri.append(host); +if (port > 0 +&& !(HTTP_SCHEME.equals(scheme) && port == HTTP_DEFAULT_PORT) +&& !(HTTPS_SCHEME.equals(scheme) && port == HTTPS_DEFAULT_PORT)) { +requestUri.append(CHAR_COLON); +requestUri.append(port); } } if (schemeSpecificPart != null) { diff --git a/src/test/java/org/apache/sling/api/uri/SlingUriTest.java b/src/test/java/org/apache/sling/api/uri/SlingUriTest.java index 8faaa71..3e11d9a 100644 --- a/src/test/java/org/apache/sling/api/uri/SlingUriTest.java +++ b/src/test/java/org/apache/sling/api/uri/SlingUriTest.java @@ -81,6 +81,46 @@ public class SlingUriTest { } @Test +public void testFullUriWithoutSchemeSimple() { + +String testUriStr = "//cdn.example.com/test/js_file.js"; + +testUri(testUriStr, false, false, false, false, false, slingUri -> { +assertEquals(null, slingUri.getScheme()); +assertEquals("//cdn.example.com/test/js_file.js", slingUri.getSchemeSpecificPart()); +assertEquals(null, slingUri.getUserInfo()); +assertEquals("cdn.example.com", slingUri.getHost()); +assertEquals(-1, slingUri.getPort()); +assertEquals("/test/js_file", slingUri.getResourcePath()); +assertEquals(null, slingUri.getSelectorString()); +assertEquals("js", slingUri.getExtension()); +assertEquals(null, slingUri.getSuffix()); +assertEquals(null, slingUri.getQuery()); +}, asList(resolver, null)); + +} + +@Test +public void testFullUriWithoutSchemeComplex() { + +String testUriStr = "//user:p...@cdn.example.com:3000/test/js_file.txt.js?par1=val1&par2=val2"; + +testUri(testUriStr, false, false, false, false, false, slingUri -> { +assertEquals(null, slingUri.getScheme()); + assertEquals("//user:p...@cdn.example.com:3000/test/js_file.txt.js?par1=val1&par2=val2", slingUri.getSchemeSpecificPart()); +assertEquals("user:pw", slingUri.getUserInfo()); +assertEquals("cdn.example.com", slingUri.getHost()); +assertEquals(3000, slingUri.getPort()); +assertEquals("/test/js_file", slingUri.getResourcePath()); +assertEquals("txt", slingUri.getSelectorString()); +assertEquals("js", slingUri.getExtension()); +assertEquals(null, slingU
[sling-org-apache-sling-resourceresolver] branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 created (now a827610)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git. at a827610 SLING-9662 Introduce Resource Mapping SPI No new revisions were added by this update.
[sling-org-apache-sling-engine] branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 created (now 7f1e391)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-engine.git. at 7f1e391 SLING-9662 Use SlingUri as provided in request from auth.core No new revisions were added by this update.
[sling-org-apache-sling-resourceresolver] 01/01: SLING-9662 Introduce Resource Mapping SPI
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI_v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git commit a8276102ad58485dbc34b042948fb21d59e877fb Author: georg.henzler AuthorDate: Fri Aug 14 07:36:58 2020 +0200 SLING-9662 Introduce Resource Mapping SPI --- pom.xml| 2 +- .../impl/CommonResourceResolverFactoryImpl.java| 9 +- .../impl/ResourceResolverFactoryActivator.java | 9 + .../impl/ResourceResolverImpl.java | 7 +- .../impl/mapping/ResourceMapperImpl.java | 23 ++- .../urimapping/MappingChainContextInternal.java| 71 +++ .../impl/urimapping/MappingChainResult.java| 45 .../urimapping/PathToUriMappingServiceImpl.java| 226 + .../urimapping/defaultmappers/BasePathMapper.java | 84 .../defaultmappers/EnsureHtmlExtensionMapper.java | 80 .../impl/EtcMappingResourceResolverTest.java | 56 ++--- .../impl/MockedResourceResolverImplTest.java | 9 +- .../resourceresolver/impl/ProviderHandlerTest.java | 2 + .../impl/ResourceDecoratorTestBase.java| 7 + .../impl/ResourceResolverImplTest.java | 2 + .../impl/ResourceResolverMangleNamespacesTest.java | 11 +- .../mapping/AbstractMappingMapEntriesTest.java | 51 ++--- .../impl/mapping/EtcMappingMapEntriesTest.java | 38 ++-- .../impl/mapping/ResourceMapperImplTest.java | 3 + .../sling/resourceresolver/util/MockTestUtil.java | 42 ++-- .../util/TestPathToUriMappingService.java | 59 ++ 21 files changed, 735 insertions(+), 101 deletions(-) diff --git a/pom.xml b/pom.xml index b056ab6..118a877 100644 --- a/pom.xml +++ b/pom.xml @@ -106,7 +106,7 @@ org.apache.sling org.apache.sling.api -2.21.0 +2.23.0-SNAPSHOT provided diff --git a/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java b/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java index b925e65..4e423c2 100644 --- a/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java +++ b/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java @@ -31,12 +31,11 @@ import java.util.Stack; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicBoolean; -import org.jetbrains.annotations.NotNull; - import org.apache.commons.collections4.BidiMap; import org.apache.sling.api.resource.LoginException; import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.mapping.PathToUriMappingService; import org.apache.sling.api.resource.path.Path; import org.apache.sling.resourceresolver.impl.console.ResourceResolverWebConsolePlugin; import org.apache.sling.resourceresolver.impl.helper.ResourceDecoratorTracker; @@ -48,6 +47,7 @@ import org.apache.sling.resourceresolver.impl.mapping.Mapping; import org.apache.sling.resourceresolver.impl.providers.ResourceProviderTracker; import org.apache.sling.serviceusermapping.ServiceUserMapper; import org.apache.sling.spi.resource.provider.ResourceProvider; +import org.jetbrains.annotations.NotNull; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.slf4j.Logger; @@ -405,6 +405,11 @@ public class CommonResourceResolverFactoryImpl implements ResourceResolverFactor return this.activator.getResourceAccessSecurityTracker(); } +/** gets PathToUriMappingServiceImpl */ +public PathToUriMappingService getPathToUriMappingService() { +return this.activator.getPathToUriMappingService(); +} + @NotNull @Override public ResourceResolver getServiceResourceResolver( diff --git a/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java b/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java index 646a077..6de579a 100644 --- a/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java +++ b/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java @@ -34,9 +34,11 @@ import org.apache.commons.collections4.BidiMap; import org.apache.commons.collections4.bidimap.TreeBidiMap; import org.apache.sling.api.resource.ResourceDecorator; import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.mapping.PathToUriMappingService; import org.apache.sling.api.resource.path.Path; import org.apache.sling.api.resource.runtime.RuntimeService; import
[sling-org-apache-sling-engine] branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI_v3 updated (b9448bd -> 7f1e391)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI_v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-engine.git. omit b9448bd SLING-9662 Use SlingUri as provided in request from auth.core new 7f1e391 SLING-9662 Use SlingUri as provided in request from auth.core This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (b9448bd) \ N -- N -- N refs/heads/feature/SLING-9662-Introduce-SlingUri-Mapping-SPI_v3 (7f1e391) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. The 1 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. Summary of changes: .../apache/sling/engine/impl/request/RequestData.java | 17 +++-- .../sling/engine/impl/request/InitResourceTest.java | 7 ++- 2 files changed, 17 insertions(+), 7 deletions(-)
[sling-org-apache-sling-api] branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 updated (7f02e81 -> 415ec0d)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git. discard 7f02e81 SLING-9745 Sling Uri Mapping SPI new 415ec0d SLING-9745 Sling Uri Mapping SPI This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (7f02e81) \ N -- N -- N refs/heads/feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 (415ec0d) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. The 1 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. Summary of changes: .../org/apache/sling/api/resource/mapping/PathToUriMappingService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
[sling-org-apache-sling-engine] 01/01: SLING-9662 Use SlingUri as provided in request from auth.core
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI_v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-engine.git commit 7f1e3916ee3a88fb1c0448f7f9837cc316d80f40 Author: georg.henzler AuthorDate: Mon Sep 21 17:13:00 2020 +0200 SLING-9662 Use SlingUri as provided in request from auth.core --- pom.xml| 4 +-- .../sling/engine/impl/request/RequestData.java | 38 -- .../engine/impl/request/InitResourceTest.java | 22 + 3 files changed, 37 insertions(+), 27 deletions(-) diff --git a/pom.xml b/pom.xml index 83d0419..9917ad6 100644 --- a/pom.xml +++ b/pom.xml @@ -111,7 +111,7 @@ org.apache.sling org.apache.sling.api -2.6.0 +2.23.0-SNAPSHOT provided @@ -123,7 +123,7 @@ org.apache.sling org.apache.sling.auth.core -1.0.0 +1.5.1-SNAPSHOT provided diff --git a/src/main/java/org/apache/sling/engine/impl/request/RequestData.java b/src/main/java/org/apache/sling/engine/impl/request/RequestData.java index 379eb83..b73a166 100644 --- a/src/main/java/org/apache/sling/engine/impl/request/RequestData.java +++ b/src/main/java/org/apache/sling/engine/impl/request/RequestData.java @@ -23,7 +23,6 @@ import static org.apache.sling.api.SlingConstants.SLING_CURRENT_SERVLET_NAME; import java.io.BufferedReader; import java.io.IOException; import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; import java.util.ArrayList; import javax.servlet.Servlet; @@ -46,8 +45,10 @@ import org.apache.sling.api.request.TooManyCallsException; import org.apache.sling.api.resource.Resource; import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.api.servlets.ServletResolver; +import org.apache.sling.api.uri.SlingUri; import org.apache.sling.api.wrappers.SlingHttpServletRequestWrapper; import org.apache.sling.api.wrappers.SlingHttpServletResponseWrapper; +import org.apache.sling.auth.core.AuthenticationSupport; import org.apache.sling.engine.impl.SlingHttpServletRequestImpl; import org.apache.sling.engine.impl.SlingHttpServletResponseImpl; import org.apache.sling.engine.impl.SlingMainServlet; @@ -213,8 +214,7 @@ public class RequestData { this.servletResponse = response; this.slingRequest = getSlingHttpServletRequestFactory().createRequest(this, this.servletRequest); -this.slingResponse = new SlingHttpServletResponseImpl(this, -servletResponse); +this.slingResponse = new SlingHttpServletResponseImpl(this, servletResponse); // Getting the RequestProgressTracker from the request attributes like // this should not be generally used, it's just a way to pass it from @@ -237,19 +237,17 @@ public class RequestData { requestProgressTracker.startTimer("ResourceResolution"); final SlingHttpServletRequest request = getSlingRequest(); -StringBuffer requestURL = servletRequest.getRequestURL(); -String path = request.getPathInfo(); -if (requestURL.indexOf(";") > -1 && !path.contains(";")) { -final String decodedURL; -try { -decodedURL = URLDecoder.decode(requestURL.toString(), "UTF-8"); -} catch (UnsupportedEncodingException e) { -throw new AssertionError("UTF-8 encoding is not supported"); -} -path = path.concat(decodedURL.substring(decodedURL.indexOf(';'))); +// Set by o.a.s.auth.core bundle +SlingUri slingUri = (SlingUri) request.getAttribute(AuthenticationSupport.REQUEST_ATTRIBUTE_URI); +if (slingUri == null) { +throw new IllegalStateException( +"SlingUri not available as attribute of request (expected to be set in bundle o.a.s.auth.core)"); } +// ensure slingUri is bound to correct resource resolver +slingUri = slingUri.adjust(b -> b.setResourceResolver(resourceResolver)); +request.setAttribute(AuthenticationSupport.REQUEST_ATTRIBUTE_URI, slingUri); -Resource resource = resourceResolver.resolve(request, path); +Resource resource = resourceResolver.resolve(request, slingUri.getPath()); if (request.getAttribute(REQUEST_RESOURCE_PATH_ATTR) == null) { request.setAttribute(REQUEST_RESOURCE_PATH_ATTR, resource.getPath()); } @@ -262,10 +260,14 @@ public class RequestData { public void initServlet(final Resource resource, final ServletResolver sr) { // the resource and the request path info, will never be null -RequestPathInfo requestPat
[sling-org-apache-sling-api] 01/01: SLING-9745 Sling Uri Mapping SPI
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git commit 415ec0d4b3dfb184d653571364a07d821a890a10 Author: georg.henzler AuthorDate: Tue Sep 22 08:47:59 2020 +0200 SLING-9745 Sling Uri Mapping SPI --- .../resource/mapping/PathToUriMappingService.java | 77 ++ .../sling/api/resource/mapping/package-info.java | 2 +- .../sling/spi/urimapping/MappingChainContext.java | 65 ++ .../sling/spi/urimapping/SlingUriMapper.java | 68 +++ .../mapping => spi/urimapping}/package-info.java | 4 +- 5 files changed, 213 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java b/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java new file mode 100644 index 000..20e45c2 --- /dev/null +++ b/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java @@ -0,0 +1,77 @@ +/* + * 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.api.resource.mapping; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.sling.api.uri.SlingUri; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.osgi.annotation.versioning.ProviderType; + +/** + * Provides a way to resolve and map paths to Sling URIs. Both operations are extensible by + * {@link org.apache.sling.spi.urimapping.SlingUriMapper} OSGi services. + * + * @since 1.1.0 (Sling API Bundle 2.23.0) + */ +@ProviderType +public interface PathToUriMappingService { + +/** The result of a map or resolve operation */ +@ProviderType +public interface Result { +/** + * The Sling URI as result of the resolve or map operation. + * + * @return the Sling URI + */ +@NotNull +SlingUri getUri(); + +/** + * Returns all intermediate mappings as produced by {@link org.apache.sling.spi.urimapping.SlingUriMapper} services + * + * @return the intermediate mappings + */ +@NotNull +Map getIntermediateMappings(); +} + +/** + * Maps a path to a Sling URI. + * + * @param referenceRequest the reference request with the same properties as the actual request that will have to resolve the produced + *URI. + * @param unmappedPath the path that is not mapped yet (may or may not contain selector, extension and suffix) + * @return a @{link PathToUriMappingService.Result} + */ +Result map(@Nullable HttpServletRequest referenceRequest, @NotNull String unmappedPath); + +/** + * Resolves a path relative to the given request. + * + * @param request the request + * @param path the path to be resolved or null for which case the information from request is used + * @return a @{link PathToUriMappingService.Result} + */ +Result resolve(@Nullable HttpServletRequest request, @Nullable String path); +} \ No newline at end of file diff --git a/src/main/java/org/apache/sling/api/resource/mapping/package-info.java b/src/main/java/org/apache/sling/api/resource/mapping/package-info.java index e871225..00a1ea1 100644 --- a/src/main/java/org/apache/sling/api/resource/mapping/package-info.java +++ b/src/main/java/org/apache/sling/api/resource/mapping/package-info.java @@ -17,7 +17,7 @@ * under the License. */ -@Version("1.0.1") +@Version("1.1.0") package org.apache.sling.api.resource.mapping; import org.osgi.annotation.versioning.Version; diff --git a/src/main/java/org/apache/sling/spi/urimapping/MappingChainContext.java b/src/main/java/org/apache/sling/spi/urimapping/MappingChainContext.java new file mode 100644 index 000..6f65aa9 --- /dev/null +++ b/src/main/java/org/apache/sling/spi/urimapping/MappingChainContext.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contribut
[sling-org-apache-sling-resourceresolver] branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI_v3 updated (36066a8 -> a827610)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI_v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git. discard 36066a8 SLING-9662 Introduce Resource Mapping SPI new a827610 SLING-9662 Introduce Resource Mapping SPI This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (36066a8) \ N -- N -- N refs/heads/feature/SLING-9662-Introduce-SlingUri-Mapping-SPI_v3 (a827610) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. The 1 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. Summary of changes: .../impl/urimapping/PathToUriMappingServiceImpl.java| 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-)
[sling-org-apache-sling-api] branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 updated (7f02e81 -> 415ec0d)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git. discard 7f02e81 SLING-9745 Sling Uri Mapping SPI new 415ec0d SLING-9745 Sling Uri Mapping SPI This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (7f02e81) \ N -- N -- N refs/heads/feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 (415ec0d) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. The 1 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. Summary of changes: .../org/apache/sling/api/resource/mapping/PathToUriMappingService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
[sling-org-apache-sling-resourceresolver] 01/01: SLING-9662 Introduce Resource Mapping SPI
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI_v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git commit a8276102ad58485dbc34b042948fb21d59e877fb Author: georg.henzler AuthorDate: Fri Aug 14 07:36:58 2020 +0200 SLING-9662 Introduce Resource Mapping SPI --- pom.xml| 2 +- .../impl/CommonResourceResolverFactoryImpl.java| 9 +- .../impl/ResourceResolverFactoryActivator.java | 9 + .../impl/ResourceResolverImpl.java | 7 +- .../impl/mapping/ResourceMapperImpl.java | 23 ++- .../urimapping/MappingChainContextInternal.java| 71 +++ .../impl/urimapping/MappingChainResult.java| 45 .../urimapping/PathToUriMappingServiceImpl.java| 226 + .../urimapping/defaultmappers/BasePathMapper.java | 84 .../defaultmappers/EnsureHtmlExtensionMapper.java | 80 .../impl/EtcMappingResourceResolverTest.java | 56 ++--- .../impl/MockedResourceResolverImplTest.java | 9 +- .../resourceresolver/impl/ProviderHandlerTest.java | 2 + .../impl/ResourceDecoratorTestBase.java| 7 + .../impl/ResourceResolverImplTest.java | 2 + .../impl/ResourceResolverMangleNamespacesTest.java | 11 +- .../mapping/AbstractMappingMapEntriesTest.java | 51 ++--- .../impl/mapping/EtcMappingMapEntriesTest.java | 38 ++-- .../impl/mapping/ResourceMapperImplTest.java | 3 + .../sling/resourceresolver/util/MockTestUtil.java | 42 ++-- .../util/TestPathToUriMappingService.java | 59 ++ 21 files changed, 735 insertions(+), 101 deletions(-) diff --git a/pom.xml b/pom.xml index b056ab6..118a877 100644 --- a/pom.xml +++ b/pom.xml @@ -106,7 +106,7 @@ org.apache.sling org.apache.sling.api -2.21.0 +2.23.0-SNAPSHOT provided diff --git a/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java b/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java index b925e65..4e423c2 100644 --- a/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java +++ b/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java @@ -31,12 +31,11 @@ import java.util.Stack; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicBoolean; -import org.jetbrains.annotations.NotNull; - import org.apache.commons.collections4.BidiMap; import org.apache.sling.api.resource.LoginException; import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.mapping.PathToUriMappingService; import org.apache.sling.api.resource.path.Path; import org.apache.sling.resourceresolver.impl.console.ResourceResolverWebConsolePlugin; import org.apache.sling.resourceresolver.impl.helper.ResourceDecoratorTracker; @@ -48,6 +47,7 @@ import org.apache.sling.resourceresolver.impl.mapping.Mapping; import org.apache.sling.resourceresolver.impl.providers.ResourceProviderTracker; import org.apache.sling.serviceusermapping.ServiceUserMapper; import org.apache.sling.spi.resource.provider.ResourceProvider; +import org.jetbrains.annotations.NotNull; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.slf4j.Logger; @@ -405,6 +405,11 @@ public class CommonResourceResolverFactoryImpl implements ResourceResolverFactor return this.activator.getResourceAccessSecurityTracker(); } +/** gets PathToUriMappingServiceImpl */ +public PathToUriMappingService getPathToUriMappingService() { +return this.activator.getPathToUriMappingService(); +} + @NotNull @Override public ResourceResolver getServiceResourceResolver( diff --git a/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java b/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java index 646a077..6de579a 100644 --- a/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java +++ b/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java @@ -34,9 +34,11 @@ import org.apache.commons.collections4.BidiMap; import org.apache.commons.collections4.bidimap.TreeBidiMap; import org.apache.sling.api.resource.ResourceDecorator; import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.mapping.PathToUriMappingService; import org.apache.sling.api.resource.path.Path; import org.apache.sling.api.resource.runtime.RuntimeService; import
[sling-org-apache-sling-resourceresolver] branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI_v3 updated (36066a8 -> a827610)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI_v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git. discard 36066a8 SLING-9662 Introduce Resource Mapping SPI new a827610 SLING-9662 Introduce Resource Mapping SPI This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (36066a8) \ N -- N -- N refs/heads/feature/SLING-9662-Introduce-SlingUri-Mapping-SPI_v3 (a827610) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. The 1 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. Summary of changes: .../impl/urimapping/PathToUriMappingServiceImpl.java| 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-)
[sling-org-apache-sling-engine] branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI_v3 updated (b9448bd -> 7f1e391)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI_v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-engine.git. omit b9448bd SLING-9662 Use SlingUri as provided in request from auth.core new 7f1e391 SLING-9662 Use SlingUri as provided in request from auth.core This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (b9448bd) \ N -- N -- N refs/heads/feature/SLING-9662-Introduce-SlingUri-Mapping-SPI_v3 (7f1e391) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. The 1 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. Summary of changes: .../apache/sling/engine/impl/request/RequestData.java | 17 +++-- .../sling/engine/impl/request/InitResourceTest.java | 7 ++- 2 files changed, 17 insertions(+), 7 deletions(-)
[sling-org-apache-sling-engine] 01/01: SLING-9662 Use SlingUri as provided in request from auth.core
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI_v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-engine.git commit 7f1e3916ee3a88fb1c0448f7f9837cc316d80f40 Author: georg.henzler AuthorDate: Mon Sep 21 17:13:00 2020 +0200 SLING-9662 Use SlingUri as provided in request from auth.core --- pom.xml| 4 +-- .../sling/engine/impl/request/RequestData.java | 38 -- .../engine/impl/request/InitResourceTest.java | 22 + 3 files changed, 37 insertions(+), 27 deletions(-) diff --git a/pom.xml b/pom.xml index 83d0419..9917ad6 100644 --- a/pom.xml +++ b/pom.xml @@ -111,7 +111,7 @@ org.apache.sling org.apache.sling.api -2.6.0 +2.23.0-SNAPSHOT provided @@ -123,7 +123,7 @@ org.apache.sling org.apache.sling.auth.core -1.0.0 +1.5.1-SNAPSHOT provided diff --git a/src/main/java/org/apache/sling/engine/impl/request/RequestData.java b/src/main/java/org/apache/sling/engine/impl/request/RequestData.java index 379eb83..b73a166 100644 --- a/src/main/java/org/apache/sling/engine/impl/request/RequestData.java +++ b/src/main/java/org/apache/sling/engine/impl/request/RequestData.java @@ -23,7 +23,6 @@ import static org.apache.sling.api.SlingConstants.SLING_CURRENT_SERVLET_NAME; import java.io.BufferedReader; import java.io.IOException; import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; import java.util.ArrayList; import javax.servlet.Servlet; @@ -46,8 +45,10 @@ import org.apache.sling.api.request.TooManyCallsException; import org.apache.sling.api.resource.Resource; import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.api.servlets.ServletResolver; +import org.apache.sling.api.uri.SlingUri; import org.apache.sling.api.wrappers.SlingHttpServletRequestWrapper; import org.apache.sling.api.wrappers.SlingHttpServletResponseWrapper; +import org.apache.sling.auth.core.AuthenticationSupport; import org.apache.sling.engine.impl.SlingHttpServletRequestImpl; import org.apache.sling.engine.impl.SlingHttpServletResponseImpl; import org.apache.sling.engine.impl.SlingMainServlet; @@ -213,8 +214,7 @@ public class RequestData { this.servletResponse = response; this.slingRequest = getSlingHttpServletRequestFactory().createRequest(this, this.servletRequest); -this.slingResponse = new SlingHttpServletResponseImpl(this, -servletResponse); +this.slingResponse = new SlingHttpServletResponseImpl(this, servletResponse); // Getting the RequestProgressTracker from the request attributes like // this should not be generally used, it's just a way to pass it from @@ -237,19 +237,17 @@ public class RequestData { requestProgressTracker.startTimer("ResourceResolution"); final SlingHttpServletRequest request = getSlingRequest(); -StringBuffer requestURL = servletRequest.getRequestURL(); -String path = request.getPathInfo(); -if (requestURL.indexOf(";") > -1 && !path.contains(";")) { -final String decodedURL; -try { -decodedURL = URLDecoder.decode(requestURL.toString(), "UTF-8"); -} catch (UnsupportedEncodingException e) { -throw new AssertionError("UTF-8 encoding is not supported"); -} -path = path.concat(decodedURL.substring(decodedURL.indexOf(';'))); +// Set by o.a.s.auth.core bundle +SlingUri slingUri = (SlingUri) request.getAttribute(AuthenticationSupport.REQUEST_ATTRIBUTE_URI); +if (slingUri == null) { +throw new IllegalStateException( +"SlingUri not available as attribute of request (expected to be set in bundle o.a.s.auth.core)"); } +// ensure slingUri is bound to correct resource resolver +slingUri = slingUri.adjust(b -> b.setResourceResolver(resourceResolver)); +request.setAttribute(AuthenticationSupport.REQUEST_ATTRIBUTE_URI, slingUri); -Resource resource = resourceResolver.resolve(request, path); +Resource resource = resourceResolver.resolve(request, slingUri.getPath()); if (request.getAttribute(REQUEST_RESOURCE_PATH_ATTR) == null) { request.setAttribute(REQUEST_RESOURCE_PATH_ATTR, resource.getPath()); } @@ -262,10 +260,14 @@ public class RequestData { public void initServlet(final Resource resource, final ServletResolver sr) { // the resource and the request path info, will never be null -RequestPathInfo requestPat
[sling-org-apache-sling-api] 01/01: SLING-9745 Sling Uri Mapping SPI
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git commit 415ec0d4b3dfb184d653571364a07d821a890a10 Author: georg.henzler AuthorDate: Tue Sep 22 08:47:59 2020 +0200 SLING-9745 Sling Uri Mapping SPI --- .../resource/mapping/PathToUriMappingService.java | 77 ++ .../sling/api/resource/mapping/package-info.java | 2 +- .../sling/spi/urimapping/MappingChainContext.java | 65 ++ .../sling/spi/urimapping/SlingUriMapper.java | 68 +++ .../mapping => spi/urimapping}/package-info.java | 4 +- 5 files changed, 213 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java b/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java new file mode 100644 index 000..20e45c2 --- /dev/null +++ b/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java @@ -0,0 +1,77 @@ +/* + * 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.api.resource.mapping; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.sling.api.uri.SlingUri; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.osgi.annotation.versioning.ProviderType; + +/** + * Provides a way to resolve and map paths to Sling URIs. Both operations are extensible by + * {@link org.apache.sling.spi.urimapping.SlingUriMapper} OSGi services. + * + * @since 1.1.0 (Sling API Bundle 2.23.0) + */ +@ProviderType +public interface PathToUriMappingService { + +/** The result of a map or resolve operation */ +@ProviderType +public interface Result { +/** + * The Sling URI as result of the resolve or map operation. + * + * @return the Sling URI + */ +@NotNull +SlingUri getUri(); + +/** + * Returns all intermediate mappings as produced by {@link org.apache.sling.spi.urimapping.SlingUriMapper} services + * + * @return the intermediate mappings + */ +@NotNull +Map getIntermediateMappings(); +} + +/** + * Maps a path to a Sling URI. + * + * @param referenceRequest the reference request with the same properties as the actual request that will have to resolve the produced + *URI. + * @param unmappedPath the path that is not mapped yet (may or may not contain selector, extension and suffix) + * @return a @{link PathToUriMappingService.Result} + */ +Result map(@Nullable HttpServletRequest referenceRequest, @NotNull String unmappedPath); + +/** + * Resolves a path relative to the given request. + * + * @param request the request + * @param path the path to be resolved or null for which case the information from request is used + * @return a @{link PathToUriMappingService.Result} + */ +Result resolve(@Nullable HttpServletRequest request, @Nullable String path); +} \ No newline at end of file diff --git a/src/main/java/org/apache/sling/api/resource/mapping/package-info.java b/src/main/java/org/apache/sling/api/resource/mapping/package-info.java index e871225..00a1ea1 100644 --- a/src/main/java/org/apache/sling/api/resource/mapping/package-info.java +++ b/src/main/java/org/apache/sling/api/resource/mapping/package-info.java @@ -17,7 +17,7 @@ * under the License. */ -@Version("1.0.1") +@Version("1.1.0") package org.apache.sling.api.resource.mapping; import org.osgi.annotation.versioning.Version; diff --git a/src/main/java/org/apache/sling/spi/urimapping/MappingChainContext.java b/src/main/java/org/apache/sling/spi/urimapping/MappingChainContext.java new file mode 100644 index 000..6f65aa9 --- /dev/null +++ b/src/main/java/org/apache/sling/spi/urimapping/MappingChainContext.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contribut
[sling-org-apache-sling-api] branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 updated (d345c0f -> 7f02e81)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git. discard d345c0f SLING-9745 Sling Uri Mapping SPI omit a0201b0 SLING-9745 Ensure invalid URIs are untouched (Unit test) omit f980f39 SLING-9745 Ensure invalid URIs are untouched omit 75079d3 SLING-9745 Use name SlingUri(Builder) instead of ResourceUri(Builder) omit 11c0a62 SLING-9745 Improve javadoc and add Nullable/NotNull annotations omit a62f388 SLING-9745 Renamed method isFullUri() to isAbsolute() to be in line with JDK URI class and removed default impl in interface. Added @ProviderType annotations omit 31fb59a SLING-9745 Avoid introducing runtime dependency to StringUtils omit 8771430 SLING-9745 Improved javadoc and added some more java URI compatibility checks omit b1b44e1 SLING-9745 Ensure getSchemeSpecificPart() matches to java URI impl omit bc65bfd SLING-9745 ResourceUri improvements from code review omit 4b6c809 SLING-9745 Introduce ResourceUri (immutable) and ResourceUriBuilder add 0aa6f2c SLING-9745 Introduce SlingUri (immutable) and SlingUriBuilder new 7f02e81 SLING-9745 Sling Uri Mapping SPI This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (d345c0f) \ N -- N -- N refs/heads/feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 (7f02e81) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. The 1 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. Summary of changes: .../java/org/apache/sling/api/uri/SlingUri.java| 12 ++-- .../org/apache/sling/api/uri/SlingUriBuilder.java | 71 +++--- .../uri/SlingUriBuilderWithAdjustMethodTest.java | 68 + .../org/apache/sling/api/uri/SlingUriTest.java | 5 ++ 4 files changed, 130 insertions(+), 26 deletions(-)
[sling-org-apache-sling-api] 01/01: SLING-9745 Sling Uri Mapping SPI
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git commit 7f02e816cbc0f7ae2dda3fb92c1e5e443fbb3082 Author: georg.henzler AuthorDate: Tue Sep 22 08:47:59 2020 +0200 SLING-9745 Sling Uri Mapping SPI --- .../resource/mapping/PathToUriMappingService.java | 76 ++ .../sling/api/resource/mapping/package-info.java | 2 +- .../sling/spi/urimapping/MappingChainContext.java | 65 ++ .../sling/spi/urimapping/SlingUriMapper.java | 68 +++ .../mapping => spi/urimapping}/package-info.java | 4 +- 5 files changed, 212 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java b/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java new file mode 100644 index 000..b0da9f2 --- /dev/null +++ b/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java @@ -0,0 +1,76 @@ +/* + * 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.api.resource.mapping; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.sling.api.uri.SlingUri; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.osgi.annotation.versioning.ProviderType; + +/** + * Provides a way to resolve and map paths to Sling URIs. + * + * @since 1.1.0 (Sling API Bundle 2.23.0) + */ +@ProviderType +public interface PathToUriMappingService { + +/** The result of a map or resolve operation */ +@ProviderType +public interface Result { +/** + * The Sling URI as result of the resolve or map operation. + * + * @return the Sling URI + */ +@NotNull +SlingUri getUri(); + +/** + * Returns all intermediate mappings as produced by {@link org.apache.sling.spi.urimapping.SlingUriMapper} services + * + * @return the intermediate mappings + */ +@NotNull +Map getIntermediateMappings(); +} + +/** + * Maps a path to a Sling URI. + * + * @param referenceRequest the reference request with the same properties as the actual request that will have to resolve the produced + *URI. + * @param unmappedPath the path that is not mapped yet (may or may not contain selector, extension and suffix) + * @return a @{link PathToUriMappingService.Result} + */ +Result map(@Nullable HttpServletRequest referenceRequest, @NotNull String unmappedPath); + +/** + * Resolves a path relative to the given request. + * + * @param request the request + * @param path the path to be resolved or null for which case the information from request is used + * @return a @{link PathToUriMappingService.Result} + */ +Result resolve(@Nullable HttpServletRequest request, @Nullable String path); +} \ No newline at end of file diff --git a/src/main/java/org/apache/sling/api/resource/mapping/package-info.java b/src/main/java/org/apache/sling/api/resource/mapping/package-info.java index e871225..00a1ea1 100644 --- a/src/main/java/org/apache/sling/api/resource/mapping/package-info.java +++ b/src/main/java/org/apache/sling/api/resource/mapping/package-info.java @@ -17,7 +17,7 @@ * under the License. */ -@Version("1.0.1") +@Version("1.1.0") package org.apache.sling.api.resource.mapping; import org.osgi.annotation.versioning.Version; diff --git a/src/main/java/org/apache/sling/spi/urimapping/MappingChainContext.java b/src/main/java/org/apache/sling/spi/urimapping/MappingChainContext.java new file mode 100644 index 000..6f65aa9 --- /dev/null +++ b/src/main/java/org/apache/sling/spi/urimapping/MappingChainContext.java @@ -0,0 +1,65 @@ +/* + * 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
[sling-org-apache-sling-api] branch master updated: SLING-9745 Introduce SlingUri (immutable) and SlingUriBuilder
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git The following commit(s) were added to refs/heads/master by this push: new 0aa6f2c SLING-9745 Introduce SlingUri (immutable) and SlingUriBuilder 0aa6f2c is described below commit 0aa6f2cd6dbc1181827ab231677edeeab7c1aa7d Author: Georg Henzler AuthorDate: Tue Sep 22 19:36:01 2020 +0200 SLING-9745 Introduce SlingUri (immutable) and SlingUriBuilder SLING-9745 Introduce SlingUri (immutable) and SlingUriBuilder General purpose class to represent a SlingUri (like e.g. a link in an html tag). Similar to JDK URI but supports Sling URI parts like selectors and suffix --- .../java/org/apache/sling/api/uri/SlingUri.java| 235 + .../org/apache/sling/api/uri/SlingUriBuilder.java | 1053 .../org/apache/sling/api/uri/package-info.java | 23 + .../apache/sling/api/uri/SlingUriBuilderTest.java | 167 .../uri/SlingUriBuilderWithAdjustMethodTest.java | 313 ++ .../sling/api/uri/SlingUriInvalidUrisTest.java | 78 ++ .../apache/sling/api/uri/SlingUriRebaseTest.java | 231 + .../org/apache/sling/api/uri/SlingUriTest.java | 443 ...UriToSlingRequestPathInfoCompatibilityTest.java | 272 + 9 files changed, 2815 insertions(+) diff --git a/src/main/java/org/apache/sling/api/uri/SlingUri.java b/src/main/java/org/apache/sling/api/uri/SlingUri.java new file mode 100644 index 000..2ad757e --- /dev/null +++ b/src/main/java/org/apache/sling/api/uri/SlingUri.java @@ -0,0 +1,235 @@ +/* + * 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.api.uri; + +import java.net.URI; +import java.util.Map; +import java.util.function.Consumer; + +import org.apache.sling.api.request.RequestPathInfo; +import org.apache.sling.api.resource.Resource; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.osgi.annotation.versioning.ProviderType; + +/** + * Represents an immutable URI in the same way as java.net.URI but is extended with Sling-specific URI parts (e.g. selectors). A SlingUri + * usually points to a resource but alternatively, can also contain an opaque URI like {@code mailto:} or {@code javascript:}. Use + * {@link SlingUri#adjust(Consumer)} or {@link SlingUriBuilder} to create new or modified Sling URIs. + * + * @since 1.0.0 (Sling API Bundle 2.23.0) + */ +@ProviderType +public interface SlingUri extends RequestPathInfo { + +/** + * Returns the {@link URI}. + * + * @return the URI + */ +@NotNull +URI toUri(); + +/** + * Returns the URI as String. + * + * @return the URI string + */ +@NotNull +String toString(); + +/** + * Returns the scheme. + * + * @return the scheme or null if not set + */ +@Nullable +String getScheme(); + +/** + * Returns the user info. + * + * @return the user info of the SlingUri or null if not set + */ +@Nullable +String getUserInfo(); + +/** + * Returns the host. + * + * @return returns the host of the SlingUri or null if not set + */ +@Nullable +String getHost(); + +/** + * Returns the port. + * + * @return returns the port of the SlingUri or -1 if not set + */ +int getPort(); + +/** + * Returns the resource path. + * + * @return returns the resource path or null if the URI does not contain a path. + */ +@Override +@Nullable +String getResourcePath(); + +/** + * Returns the selector string. + * + * @return returns the selector string or null if the URI does not contain selector(s) + */ +@Override +@Nullable +String getSelectorString(); + +/** + * Returns the selectors array. + * + * @return the selectors array (empty if the URI does not contain selector(s), never null) + */ +@Override +@NotNull +String[] getSelectors(); + +/** + * Returns the extension. + * + * @return the extensio
[sling-org-apache-sling-auth-core] branch master updated (637add6 -> f44e534)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-auth-core.git. from 637add6 [maven-release-plugin] prepare for next development iteration add c03b9a8 Cleanup unit test new f44e534 Merge pull request #5 from apache/bugfix/cleanup-unit-test The 1 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. Summary of changes: .../auth/core/impl/SlingAuthenticatorTest.java | 25 ++ 1 file changed, 11 insertions(+), 14 deletions(-)
[sling-org-apache-sling-auth-core] 01/01: Merge pull request #5 from apache/bugfix/cleanup-unit-test
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-auth-core.git commit f44e5348188fae1d0821b567621a307ca7165d20 Merge: 637add6 c03b9a8 Author: Georg Henzler AuthorDate: Tue Sep 22 19:33:56 2020 +0200 Merge pull request #5 from apache/bugfix/cleanup-unit-test this is a safe change (just a JUnit fix) .../auth/core/impl/SlingAuthenticatorTest.java | 25 ++ 1 file changed, 11 insertions(+), 14 deletions(-)
[sling-org-apache-sling-api] branch feature/SLING-9745-ResourceUri-Api updated (4c4cf93 -> a0d03f9)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9745-ResourceUri-Api in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git. from 4c4cf93 SLING-9745 Improved behavior for setPath(null) and adjusted javadoc add a0d03f9 SLING-9745 Add missing @NotNull/@Null annotations No new revisions were added by this update. Summary of changes: .../java/org/apache/sling/api/uri/SlingUri.java| 2 +- .../org/apache/sling/api/uri/SlingUriBuilder.java | 24 +++--- 2 files changed, 13 insertions(+), 13 deletions(-)
[sling-org-apache-sling-api] branch feature/SLING-9745-ResourceUri-Api updated (75bc3fe -> 4c4cf93)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9745-ResourceUri-Api in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git. discard 75bc3fe SLING-9745 Improved behavior for setPath(null) and adjusted javadoc add 4c4cf93 SLING-9745 Improved behavior for setPath(null) and adjusted javadoc This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (75bc3fe) \ N -- N -- N refs/heads/feature/SLING-9745-ResourceUri-Api (4c4cf93) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. No new revisions were added by this update. Summary of changes: src/main/java/org/apache/sling/api/uri/SlingUriBuilder.java | 4 ++-- .../org/apache/sling/api/uri/SlingUriBuilderWithAdjustMethodTest.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
[sling-org-apache-sling-api] branch feature/SLING-9745-ResourceUri-Api updated (bcc12d2 -> 75bc3fe)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9745-ResourceUri-Api in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git. from bcc12d2 SLING-9745 Adding missing @Nullable/@NotNull annotations with more assertions for getSelectors() in JUnit test, better javadoc link add 75bc3fe SLING-9745 Improved behavior for setPath(null) and adjusted javadoc No new revisions were added by this update. Summary of changes: .../java/org/apache/sling/api/uri/SlingUri.java| 1 + .../org/apache/sling/api/uri/SlingUriBuilder.java | 19 +++--- .../uri/SlingUriBuilderWithAdjustMethodTest.java | 68 ++ 3 files changed, 79 insertions(+), 9 deletions(-)
[sling-org-apache-sling-api] branch feature/SLING-9745-ResourceUri-Api updated (deddd6a -> bcc12d2)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9745-ResourceUri-Api in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git. discard deddd6a SLING-9745 Adding missing @Nullable/@NotNull annotations with more assertions for getSelectors() in JUnit test, better javadoc link add bcc12d2 SLING-9745 Adding missing @Nullable/@NotNull annotations with more assertions for getSelectors() in JUnit test, better javadoc link This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (deddd6a) \ N -- N -- N refs/heads/feature/SLING-9745-ResourceUri-Api (bcc12d2) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. No new revisions were added by this update. Summary of changes: src/main/java/org/apache/sling/api/uri/SlingUri.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
[sling-org-apache-sling-api] branch feature/SLING-9745-ResourceUri-Api updated (a0201b0 -> deddd6a)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9745-ResourceUri-Api in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git. from a0201b0 SLING-9745 Ensure invalid URIs are untouched (Unit test) add deddd6a SLING-9745 Adding missing @Nullable/@NotNull annotations with more assertions for getSelectors() in JUnit test, better javadoc link No new revisions were added by this update. Summary of changes: .../java/org/apache/sling/api/uri/SlingUri.java| 6 +++-- .../org/apache/sling/api/uri/SlingUriBuilder.java | 28 ++ .../org/apache/sling/api/uri/SlingUriTest.java | 5 3 files changed, 37 insertions(+), 2 deletions(-)
[sling-org-apache-sling-api] branch feature/SLING-9745-ResourceUri-Api updated (f980f39 -> a0201b0)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9745-ResourceUri-Api in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git. from f980f39 SLING-9745 Ensure invalid URIs are untouched add a0201b0 SLING-9745 Ensure invalid URIs are untouched (Unit test) No new revisions were added by this update. Summary of changes: .../sling/api/uri/SlingUriInvalidUrisTest.java | 78 ++ 1 file changed, 78 insertions(+) create mode 100644 src/test/java/org/apache/sling/api/uri/SlingUriInvalidUrisTest.java
[sling-org-apache-sling-api] 01/01: SLING-9745 Sling Uri Mapping SPI
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git commit d345c0f3359bd87522003f88be5560d35a8dc3c5 Author: georg.henzler AuthorDate: Tue Sep 22 08:47:59 2020 +0200 SLING-9745 Sling Uri Mapping SPI --- .../resource/mapping/PathToUriMappingService.java | 76 ++ .../sling/api/resource/mapping/package-info.java | 2 +- .../sling/spi/urimapping/MappingChainContext.java | 65 ++ .../sling/spi/urimapping/SlingUriMapper.java | 68 +++ .../mapping => spi/urimapping}/package-info.java | 4 +- 5 files changed, 212 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java b/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java new file mode 100644 index 000..b0da9f2 --- /dev/null +++ b/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java @@ -0,0 +1,76 @@ +/* + * 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.api.resource.mapping; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.sling.api.uri.SlingUri; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.osgi.annotation.versioning.ProviderType; + +/** + * Provides a way to resolve and map paths to Sling URIs. + * + * @since 1.1.0 (Sling API Bundle 2.23.0) + */ +@ProviderType +public interface PathToUriMappingService { + +/** The result of a map or resolve operation */ +@ProviderType +public interface Result { +/** + * The Sling URI as result of the resolve or map operation. + * + * @return the Sling URI + */ +@NotNull +SlingUri getUri(); + +/** + * Returns all intermediate mappings as produced by {@link org.apache.sling.spi.urimapping.SlingUriMapper} services + * + * @return the intermediate mappings + */ +@NotNull +Map getIntermediateMappings(); +} + +/** + * Maps a path to a Sling URI. + * + * @param referenceRequest the reference request with the same properties as the actual request that will have to resolve the produced + *URI. + * @param unmappedPath the path that is not mapped yet (may or may not contain selector, extension and suffix) + * @return a @{link PathToUriMappingService.Result} + */ +Result map(@Nullable HttpServletRequest referenceRequest, @NotNull String unmappedPath); + +/** + * Resolves a path relative to the given request. + * + * @param request the request + * @param path the path to be resolved or null for which case the information from request is used + * @return a @{link PathToUriMappingService.Result} + */ +Result resolve(@Nullable HttpServletRequest request, @Nullable String path); +} \ No newline at end of file diff --git a/src/main/java/org/apache/sling/api/resource/mapping/package-info.java b/src/main/java/org/apache/sling/api/resource/mapping/package-info.java index e871225..00a1ea1 100644 --- a/src/main/java/org/apache/sling/api/resource/mapping/package-info.java +++ b/src/main/java/org/apache/sling/api/resource/mapping/package-info.java @@ -17,7 +17,7 @@ * under the License. */ -@Version("1.0.1") +@Version("1.1.0") package org.apache.sling.api.resource.mapping; import org.osgi.annotation.versioning.Version; diff --git a/src/main/java/org/apache/sling/spi/urimapping/MappingChainContext.java b/src/main/java/org/apache/sling/spi/urimapping/MappingChainContext.java new file mode 100644 index 000..6f65aa9 --- /dev/null +++ b/src/main/java/org/apache/sling/spi/urimapping/MappingChainContext.java @@ -0,0 +1,65 @@ +/* + * 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
[sling-org-apache-sling-api] branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 updated (364ffe3 -> d345c0f)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git. discard 364ffe3 SLING-9745 Sling Uri Mapping SPI add a0201b0 SLING-9745 Ensure invalid URIs are untouched (Unit test) new d345c0f SLING-9745 Sling Uri Mapping SPI This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (364ffe3) \ N -- N -- N refs/heads/feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 (d345c0f) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. The 1 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. Summary of changes:
[sling-org-apache-sling-api] branch feature/SLING-9745-ResourceUri-Api updated (f980f39 -> a0201b0)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9745-ResourceUri-Api in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git. from f980f39 SLING-9745 Ensure invalid URIs are untouched add a0201b0 SLING-9745 Ensure invalid URIs are untouched (Unit test) No new revisions were added by this update. Summary of changes: .../sling/api/uri/SlingUriInvalidUrisTest.java | 78 ++ 1 file changed, 78 insertions(+) create mode 100644 src/test/java/org/apache/sling/api/uri/SlingUriInvalidUrisTest.java
[sling-org-apache-sling-api] 01/01: SLING-9745 Sling Uri Mapping SPI
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git commit d345c0f3359bd87522003f88be5560d35a8dc3c5 Author: georg.henzler AuthorDate: Tue Sep 22 08:47:59 2020 +0200 SLING-9745 Sling Uri Mapping SPI --- .../resource/mapping/PathToUriMappingService.java | 76 ++ .../sling/api/resource/mapping/package-info.java | 2 +- .../sling/spi/urimapping/MappingChainContext.java | 65 ++ .../sling/spi/urimapping/SlingUriMapper.java | 68 +++ .../mapping => spi/urimapping}/package-info.java | 4 +- 5 files changed, 212 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java b/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java new file mode 100644 index 000..b0da9f2 --- /dev/null +++ b/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java @@ -0,0 +1,76 @@ +/* + * 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.api.resource.mapping; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.sling.api.uri.SlingUri; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.osgi.annotation.versioning.ProviderType; + +/** + * Provides a way to resolve and map paths to Sling URIs. + * + * @since 1.1.0 (Sling API Bundle 2.23.0) + */ +@ProviderType +public interface PathToUriMappingService { + +/** The result of a map or resolve operation */ +@ProviderType +public interface Result { +/** + * The Sling URI as result of the resolve or map operation. + * + * @return the Sling URI + */ +@NotNull +SlingUri getUri(); + +/** + * Returns all intermediate mappings as produced by {@link org.apache.sling.spi.urimapping.SlingUriMapper} services + * + * @return the intermediate mappings + */ +@NotNull +Map getIntermediateMappings(); +} + +/** + * Maps a path to a Sling URI. + * + * @param referenceRequest the reference request with the same properties as the actual request that will have to resolve the produced + *URI. + * @param unmappedPath the path that is not mapped yet (may or may not contain selector, extension and suffix) + * @return a @{link PathToUriMappingService.Result} + */ +Result map(@Nullable HttpServletRequest referenceRequest, @NotNull String unmappedPath); + +/** + * Resolves a path relative to the given request. + * + * @param request the request + * @param path the path to be resolved or null for which case the information from request is used + * @return a @{link PathToUriMappingService.Result} + */ +Result resolve(@Nullable HttpServletRequest request, @Nullable String path); +} \ No newline at end of file diff --git a/src/main/java/org/apache/sling/api/resource/mapping/package-info.java b/src/main/java/org/apache/sling/api/resource/mapping/package-info.java index e871225..00a1ea1 100644 --- a/src/main/java/org/apache/sling/api/resource/mapping/package-info.java +++ b/src/main/java/org/apache/sling/api/resource/mapping/package-info.java @@ -17,7 +17,7 @@ * under the License. */ -@Version("1.0.1") +@Version("1.1.0") package org.apache.sling.api.resource.mapping; import org.osgi.annotation.versioning.Version; diff --git a/src/main/java/org/apache/sling/spi/urimapping/MappingChainContext.java b/src/main/java/org/apache/sling/spi/urimapping/MappingChainContext.java new file mode 100644 index 000..6f65aa9 --- /dev/null +++ b/src/main/java/org/apache/sling/spi/urimapping/MappingChainContext.java @@ -0,0 +1,65 @@ +/* + * 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
[sling-org-apache-sling-api] branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 updated (364ffe3 -> d345c0f)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git. discard 364ffe3 SLING-9745 Sling Uri Mapping SPI add a0201b0 SLING-9745 Ensure invalid URIs are untouched (Unit test) new d345c0f SLING-9745 Sling Uri Mapping SPI This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (364ffe3) \ N -- N -- N refs/heads/feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 (d345c0f) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. The 1 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. Summary of changes:
[sling-org-apache-sling-engine] branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI_v3 created (now b9448bd)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI_v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-engine.git. at b9448bd SLING-9662 Use SlingUri as provided in request from auth.core This branch includes the following new commits: new b9448bd SLING-9662 Use SlingUri as provided in request from auth.core The 1 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.
[sling-org-apache-sling-engine] 01/01: SLING-9662 Use SlingUri as provided in request from auth.core
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI_v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-engine.git commit b9448bd06dfe66f2661bd1850045b4306ab0f8a2 Author: georg.henzler AuthorDate: Mon Sep 21 17:13:00 2020 +0200 SLING-9662 Use SlingUri as provided in request from auth.core --- pom.xml| 4 ++-- .../sling/engine/impl/request/RequestData.java | 23 ++ .../engine/impl/request/InitResourceTest.java | 17 +--- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/pom.xml b/pom.xml index 83d0419..9917ad6 100644 --- a/pom.xml +++ b/pom.xml @@ -111,7 +111,7 @@ org.apache.sling org.apache.sling.api -2.6.0 +2.23.0-SNAPSHOT provided @@ -123,7 +123,7 @@ org.apache.sling org.apache.sling.auth.core -1.0.0 +1.5.1-SNAPSHOT provided diff --git a/src/main/java/org/apache/sling/engine/impl/request/RequestData.java b/src/main/java/org/apache/sling/engine/impl/request/RequestData.java index 379eb83..71f9921 100644 --- a/src/main/java/org/apache/sling/engine/impl/request/RequestData.java +++ b/src/main/java/org/apache/sling/engine/impl/request/RequestData.java @@ -25,6 +25,7 @@ import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.util.ArrayList; +import java.util.Map; import javax.servlet.Servlet; import javax.servlet.ServletException; @@ -46,8 +47,10 @@ import org.apache.sling.api.request.TooManyCallsException; import org.apache.sling.api.resource.Resource; import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.api.servlets.ServletResolver; +import org.apache.sling.api.uri.SlingUri; import org.apache.sling.api.wrappers.SlingHttpServletRequestWrapper; import org.apache.sling.api.wrappers.SlingHttpServletResponseWrapper; +import org.apache.sling.auth.core.AuthenticationSupport; import org.apache.sling.engine.impl.SlingHttpServletRequestImpl; import org.apache.sling.engine.impl.SlingHttpServletResponseImpl; import org.apache.sling.engine.impl.SlingMainServlet; @@ -213,8 +216,7 @@ public class RequestData { this.servletResponse = response; this.slingRequest = getSlingHttpServletRequestFactory().createRequest(this, this.servletRequest); -this.slingResponse = new SlingHttpServletResponseImpl(this, -servletResponse); +this.slingResponse = new SlingHttpServletResponseImpl(this, servletResponse); // Getting the RequestProgressTracker from the request attributes like // this should not be generally used, it's just a way to pass it from @@ -237,19 +239,14 @@ public class RequestData { requestProgressTracker.startTimer("ResourceResolution"); final SlingHttpServletRequest request = getSlingRequest(); -StringBuffer requestURL = servletRequest.getRequestURL(); -String path = request.getPathInfo(); -if (requestURL.indexOf(";") > -1 && !path.contains(";")) { -final String decodedURL; -try { -decodedURL = URLDecoder.decode(requestURL.toString(), "UTF-8"); -} catch (UnsupportedEncodingException e) { -throw new AssertionError("UTF-8 encoding is not supported"); -} -path = path.concat(decodedURL.substring(decodedURL.indexOf(';'))); +// Set by o.a.s.auth.core bundle +SlingUri slingUri = (SlingUri) request.getAttribute(AuthenticationSupport.REQUEST_ATTRIBUTE_URI); +if (slingUri == null) { +throw new IllegalStateException( +"SlingUri not available as attribute of request (expected to be set in bundle o.a.s.auth.core)"); } -Resource resource = resourceResolver.resolve(request, path); +Resource resource = resourceResolver.resolve(request, slingUri.getPath()); if (request.getAttribute(REQUEST_RESOURCE_PATH_ATTR) == null) { request.setAttribute(REQUEST_RESOURCE_PATH_ATTR, resource.getPath()); } diff --git a/src/test/java/org/apache/sling/engine/impl/request/InitResourceTest.java b/src/test/java/org/apache/sling/engine/impl/request/InitResourceTest.java index 9e5f1ce..92be856 100644 --- a/src/test/java/org/apache/sling/engine/impl/request/InitResourceTest.java +++ b/src/test/java/org/apache/sling/engine/impl/request/InitResourceTest.java @@ -24,6 +24,8 @@ import javax.servlet.http.HttpServletResponse; import org.apache.sling.api.request.RequestProgressTracker; import org.apache.sling.ap
[sling-org-apache-sling-resourceresolver] 01/01: SLING-9662 Introduce Resource Mapping SPI
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI_v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git commit 36066a892387741d3610a431279f30ea8fb68939 Author: georg.henzler AuthorDate: Fri Aug 14 07:36:58 2020 +0200 SLING-9662 Introduce Resource Mapping SPI --- pom.xml| 2 +- .../impl/CommonResourceResolverFactoryImpl.java| 9 +- .../impl/ResourceResolverFactoryActivator.java | 9 + .../impl/ResourceResolverImpl.java | 7 +- .../impl/mapping/ResourceMapperImpl.java | 23 ++- .../urimapping/MappingChainContextInternal.java| 71 +++ .../impl/urimapping/MappingChainResult.java| 45 + .../urimapping/PathToUriMappingServiceImpl.java| 219 + .../urimapping/defaultmappers/BasePathMapper.java | 84 .../defaultmappers/EnsureHtmlExtensionMapper.java | 80 .../impl/EtcMappingResourceResolverTest.java | 56 +++--- .../impl/MockedResourceResolverImplTest.java | 9 +- .../resourceresolver/impl/ProviderHandlerTest.java | 2 + .../impl/ResourceDecoratorTestBase.java| 7 + .../impl/ResourceResolverImplTest.java | 2 + .../impl/ResourceResolverMangleNamespacesTest.java | 11 +- .../mapping/AbstractMappingMapEntriesTest.java | 51 ++--- .../impl/mapping/EtcMappingMapEntriesTest.java | 38 ++-- .../impl/mapping/ResourceMapperImplTest.java | 3 + .../sling/resourceresolver/util/MockTestUtil.java | 42 ++-- .../util/TestPathToUriMappingService.java | 59 ++ 21 files changed, 728 insertions(+), 101 deletions(-) diff --git a/pom.xml b/pom.xml index b056ab6..118a877 100644 --- a/pom.xml +++ b/pom.xml @@ -106,7 +106,7 @@ org.apache.sling org.apache.sling.api -2.21.0 +2.23.0-SNAPSHOT provided diff --git a/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java b/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java index b925e65..4e423c2 100644 --- a/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java +++ b/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java @@ -31,12 +31,11 @@ import java.util.Stack; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicBoolean; -import org.jetbrains.annotations.NotNull; - import org.apache.commons.collections4.BidiMap; import org.apache.sling.api.resource.LoginException; import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.mapping.PathToUriMappingService; import org.apache.sling.api.resource.path.Path; import org.apache.sling.resourceresolver.impl.console.ResourceResolverWebConsolePlugin; import org.apache.sling.resourceresolver.impl.helper.ResourceDecoratorTracker; @@ -48,6 +47,7 @@ import org.apache.sling.resourceresolver.impl.mapping.Mapping; import org.apache.sling.resourceresolver.impl.providers.ResourceProviderTracker; import org.apache.sling.serviceusermapping.ServiceUserMapper; import org.apache.sling.spi.resource.provider.ResourceProvider; +import org.jetbrains.annotations.NotNull; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.slf4j.Logger; @@ -405,6 +405,11 @@ public class CommonResourceResolverFactoryImpl implements ResourceResolverFactor return this.activator.getResourceAccessSecurityTracker(); } +/** gets PathToUriMappingServiceImpl */ +public PathToUriMappingService getPathToUriMappingService() { +return this.activator.getPathToUriMappingService(); +} + @NotNull @Override public ResourceResolver getServiceResourceResolver( diff --git a/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java b/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java index 646a077..6de579a 100644 --- a/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java +++ b/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java @@ -34,9 +34,11 @@ import org.apache.commons.collections4.BidiMap; import org.apache.commons.collections4.bidimap.TreeBidiMap; import org.apache.sling.api.resource.ResourceDecorator; import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.mapping.PathToUriMappingService; import org.apache.sling.api.resource.path.Path; import org.apache.sling.api.resource.runtime.RuntimeService; import
[sling-org-apache-sling-resourceresolver] branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI_v3 created (now 36066a8)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI_v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git. at 36066a8 SLING-9662 Introduce Resource Mapping SPI This branch includes the following new commits: new 36066a8 SLING-9662 Introduce Resource Mapping SPI The 1 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.
[sling-org-apache-sling-auth-core] 01/01: SLING-9662 Use PathToUriMappingService to pre-process path before authentication
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-auth-core.git commit 64326aee30a3b904ffa21c8e67162df69575e31a Author: georg.henzler AuthorDate: Mon Sep 21 10:44:56 2020 +0200 SLING-9662 Use PathToUriMappingService to pre-process path before authentication --- pom.xml| 2 +- .../sling/auth/core/AuthenticationSupport.java | 8 +++ .../sling/auth/core/impl/SlingAuthenticator.java | 33 +- .../org/apache/sling/auth/core/package-info.java | 4 +- .../auth/core/impl/SlingAuthenticatorTest.java | 77 ++ 5 files changed, 64 insertions(+), 60 deletions(-) diff --git a/pom.xml b/pom.xml index fb78d39..4b03116 100644 --- a/pom.xml +++ b/pom.xml @@ -71,7 +71,7 @@ org.apache.sling org.apache.sling.api -2.20.0 +2.23.0-SNAPSHOT provided diff --git a/src/main/java/org/apache/sling/auth/core/AuthenticationSupport.java b/src/main/java/org/apache/sling/auth/core/AuthenticationSupport.java index 7257110..0f2dd4d 100644 --- a/src/main/java/org/apache/sling/auth/core/AuthenticationSupport.java +++ b/src/main/java/org/apache/sling/auth/core/AuthenticationSupport.java @@ -85,6 +85,14 @@ public interface AuthenticationSupport { static final String REQUEST_ATTRIBUTE_RESOLVER = "org.apache.sling.auth.core.ResourceResolver"; /** + * The name of the request attribute set by the {@link #handleSecurity(HttpServletRequest, HttpServletResponse)} method for the request + * URI that was resolved already. + * + * The request attribute is set to a Sling SlingUri as provided by PathToUriMappingService.resolve(). + */ +static final String REQUEST_ATTRIBUTE_URI = "org.apache.sling.auth.core.SlingUri"; + +/** * The name of the request parameter indicating where to redirect to after * successful authentication (and optional impersonation). This parameter is * respected if either anonymous authentication or regular authentication diff --git a/src/main/java/org/apache/sling/auth/core/impl/SlingAuthenticator.java b/src/main/java/org/apache/sling/auth/core/impl/SlingAuthenticator.java index 6e203cc..0f2054a 100644 --- a/src/main/java/org/apache/sling/auth/core/impl/SlingAuthenticator.java +++ b/src/main/java/org/apache/sling/auth/core/impl/SlingAuthenticator.java @@ -50,6 +50,8 @@ import org.apache.sling.api.auth.NoAuthenticationHandlerException; import org.apache.sling.api.resource.LoginException; import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.mapping.PathToUriMappingService; +import org.apache.sling.api.uri.SlingUri; import org.apache.sling.auth.core.AuthConstants; import org.apache.sling.auth.core.AuthUtil; import org.apache.sling.auth.core.AuthenticationSupport; @@ -260,6 +262,9 @@ public class SlingAuthenticator implements Authenticator, @Reference private ResourceResolverFactory resourceResolverFactory; +@Reference +private PathToUriMappingService pathToUriMappingService; + private PathBasedHolderCache authHandlerCache = new PathBasedHolderCache(); // package protected for access in inner class ... @@ -506,7 +511,7 @@ public class SlingAuthenticator implements Authenticator, private boolean doHandleSecurity(HttpServletRequest request, HttpServletResponse response) { -// 0. Check for request attribute; set if not present +// 0 Check for request attribute; set if not present Object authUriSufficesAttr = request .getAttribute(AuthConstants.ATTR_REQUEST_AUTH_URI_SUFFIX); if (authUriSufficesAttr == null && authUriSuffices != null) { @@ -747,22 +752,18 @@ public class SlingAuthenticator implements Authenticator, * @return The path */ private String getPath(final HttpServletRequest request) { -final StringBuilder sb = new StringBuilder(); -if (request.getServletPath() != null) { -sb.append(request.getServletPath()); -} -if (request.getPathInfo() != null) { -sb.append(request.getPathInfo()); -} -String path = sb.toString(); -// Get the path used to select the authenticator, if the SlingServlet -// itself has been requested without any more info, this will be empty -// and we assume the root (SLING-722) -if (path.length() == 0) { -path = "/"; -} -return path; +// this method is safely called from all three public entry points (that is handleSecurity(), login(), logout()) +// for all execution paths +
[sling-org-apache-sling-auth-core] branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 created (now 64326ae)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-auth-core.git. at 64326ae SLING-9662 Use PathToUriMappingService to pre-process path before authentication This branch includes the following new commits: new 64326ae SLING-9662 Use PathToUriMappingService to pre-process path before authentication The 1 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.
[sling-org-apache-sling-api] branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 created (now 364ffe3)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git. at 364ffe3 SLING-9745 Sling Uri Mapping SPI This branch includes the following new commits: new 364ffe3 SLING-9745 Sling Uri Mapping SPI The 1 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.
[sling-org-apache-sling-api] 01/01: SLING-9745 Sling Uri Mapping SPI
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch feature/SLING-9662-Introduce-SlingUri-Mapping-SPI-v3 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git commit 364ffe3ef4ced4267f112c8639e8ce5ab81e8b46 Author: georg.henzler AuthorDate: Mon Sep 21 11:28:19 2020 +0200 SLING-9745 Sling Uri Mapping SPI --- .../resource/mapping/PathToUriMappingService.java | 76 + .../sling/api/resource/mapping/package-info.java | 2 +- .../sling/spi/urimapping/MappingChainContext.java | 65 ++ .../sling/spi/urimapping/SlingUriMapper.java | 68 +++ .../mapping => spi/urimapping}/package-info.java | 4 +- .../sling/api/uri/SlingUriInvalidUrisTest.java | 78 ++ 6 files changed, 290 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java b/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java new file mode 100644 index 000..b0da9f2 --- /dev/null +++ b/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java @@ -0,0 +1,76 @@ +/* + * 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.api.resource.mapping; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.sling.api.uri.SlingUri; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.osgi.annotation.versioning.ProviderType; + +/** + * Provides a way to resolve and map paths to Sling URIs. + * + * @since 1.1.0 (Sling API Bundle 2.23.0) + */ +@ProviderType +public interface PathToUriMappingService { + +/** The result of a map or resolve operation */ +@ProviderType +public interface Result { +/** + * The Sling URI as result of the resolve or map operation. + * + * @return the Sling URI + */ +@NotNull +SlingUri getUri(); + +/** + * Returns all intermediate mappings as produced by {@link org.apache.sling.spi.urimapping.SlingUriMapper} services + * + * @return the intermediate mappings + */ +@NotNull +Map getIntermediateMappings(); +} + +/** + * Maps a path to a Sling URI. + * + * @param referenceRequest the reference request with the same properties as the actual request that will have to resolve the produced + *URI. + * @param unmappedPath the path that is not mapped yet (may or may not contain selector, extension and suffix) + * @return a @{link PathToUriMappingService.Result} + */ +Result map(@Nullable HttpServletRequest referenceRequest, @NotNull String unmappedPath); + +/** + * Resolves a path relative to the given request. + * + * @param request the request + * @param path the path to be resolved or null for which case the information from request is used + * @return a @{link PathToUriMappingService.Result} + */ +Result resolve(@Nullable HttpServletRequest request, @Nullable String path); +} \ No newline at end of file diff --git a/src/main/java/org/apache/sling/api/resource/mapping/package-info.java b/src/main/java/org/apache/sling/api/resource/mapping/package-info.java index e871225..00a1ea1 100644 --- a/src/main/java/org/apache/sling/api/resource/mapping/package-info.java +++ b/src/main/java/org/apache/sling/api/resource/mapping/package-info.java @@ -17,7 +17,7 @@ * under the License. */ -@Version("1.0.1") +@Version("1.1.0") package org.apache.sling.api.resource.mapping; import org.osgi.annotation.versioning.Version; diff --git a/src/main/java/org/apache/sling/spi/urimapping/MappingChainContext.java b/src/main/java/org/apache/sling/spi/urimapping/MappingChainContext.java new file mode 100644 index 000..6f65aa9 --- /dev/null +++ b/src/main/java/org/apache/sling/spi/urimapping/MappingChainContext.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOT
[sling-org-apache-sling-api] branch feature/SLING-9745-ResourceUri-Api updated (11c0a62 -> f980f39)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9745-ResourceUri-Api in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git. from 11c0a62 SLING-9745 Improve javadoc and add Nullable/NotNull annotations add 75079d3 SLING-9745 Use name SlingUri(Builder) instead of ResourceUri(Builder) add f980f39 SLING-9745 Ensure invalid URIs are untouched No new revisions were added by this update. Summary of changes: .../uri/ResourceUri.java => uri/SlingUri.java} | 27 +- .../SlingUriBuilder.java} | 184 + .../sling/api/{resource => }/uri/package-info.java | 2 +- .../ResourceUriBuilderWithAdjustMethodTest.java| 244 .../sling/api/resource/uri/ResourceUriTest.java| 438 - .../SlingUriBuilderTest.java} | 41 +- .../uri/SlingUriBuilderWithAdjustMethodTest.java | 245 .../SlingUriRebaseTest.java} | 118 +++--- .../org/apache/sling/api/uri/SlingUriTest.java | 438 + ...riToSlingRequestPathInfoCompatibilityTest.java} | 52 +-- 10 files changed, 903 insertions(+), 886 deletions(-) rename src/main/java/org/apache/sling/api/{resource/uri/ResourceUri.java => uri/SlingUri.java} (83%) rename src/main/java/org/apache/sling/api/{resource/uri/ResourceUriBuilder.java => uri/SlingUriBuilder.java} (84%) rename src/main/java/org/apache/sling/api/{resource => }/uri/package-info.java (95%) delete mode 100644 src/test/java/org/apache/sling/api/resource/uri/ResourceUriBuilderWithAdjustMethodTest.java delete mode 100644 src/test/java/org/apache/sling/api/resource/uri/ResourceUriTest.java rename src/test/java/org/apache/sling/api/{resource/uri/ResourceUriBuilderTest.java => uri/SlingUriBuilderTest.java} (81%) create mode 100644 src/test/java/org/apache/sling/api/uri/SlingUriBuilderWithAdjustMethodTest.java rename src/test/java/org/apache/sling/api/{resource/uri/ResourceUriRebaseTest.java => uri/SlingUriRebaseTest.java} (68%) create mode 100644 src/test/java/org/apache/sling/api/uri/SlingUriTest.java rename src/test/java/org/apache/sling/api/{resource/uri/ResourceUriToSlingRequestPathInfoCompatibilityTest.java => uri/SlingUriToSlingRequestPathInfoCompatibilityTest.java} (81%)
[sling-org-apache-sling-auth-core] 01/01: Cleanup unit test
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch bugfix/cleanup-unit-test in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-auth-core.git commit c03b9a89a2c364c2eebca3543a1863b519a893f2 Author: georg.henzler AuthorDate: Mon Sep 21 10:58:25 2020 +0200 Cleanup unit test request.getAttribute("path") is not used anymore in main code and should not be mocked --- .../auth/core/impl/SlingAuthenticatorTest.java | 25 ++ 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/test/java/org/apache/sling/auth/core/impl/SlingAuthenticatorTest.java b/src/test/java/org/apache/sling/auth/core/impl/SlingAuthenticatorTest.java index d6b5c3c..d3654cf 100644 --- a/src/test/java/org/apache/sling/auth/core/impl/SlingAuthenticatorTest.java +++ b/src/test/java/org/apache/sling/auth/core/impl/SlingAuthenticatorTest.java @@ -116,7 +116,7 @@ public class SlingAuthenticatorTest { PrivateAccessor.setField(slingAuthenticator, "authHandlerCache", authRequiredCache); final HttpServletRequest request = Mockito.mock(HttpServletRequest.class); -buildExpectationsForRequestPathAndAuthPath(request, REQUEST_CHILD_NODE, PROTECTED_PATH); +buildExpectationsForRequest(request, REQUEST_CHILD_NODE); AuthenticationInfo authInfo = (AuthenticationInfo) PrivateAccessor.invoke(slingAuthenticator, "getAuthenticationInfo", new Class[]{HttpServletRequest.class, HttpServletResponse.class}, new Object[]{request, Mockito.mock(HttpServletResponse.class)}); @@ -143,7 +143,7 @@ public class SlingAuthenticatorTest { PrivateAccessor.setField(slingAuthenticator, "authHandlerCache", authRequiredCache); final HttpServletRequest request = Mockito.mock(HttpServletRequest.class); -buildExpectationsForRequestPathAndAuthPath(request, REQUEST_CHILD_NODE, PROTECTED_PATH); +buildExpectationsForRequest(request, REQUEST_CHILD_NODE); AuthenticationInfo authInfo = (AuthenticationInfo) PrivateAccessor.invoke(slingAuthenticator, "getAuthenticationInfo", new Class[]{HttpServletRequest.class, HttpServletResponse.class}, new Object[]{request, Mockito.mock(HttpServletResponse.class)}); @@ -170,7 +170,7 @@ public class SlingAuthenticatorTest { PrivateAccessor.setField(slingAuthenticator, "authHandlerCache", authRequiredCache); final HttpServletRequest request = Mockito.mock(HttpServletRequest.class); -buildExpectationsForRequestPathAndAuthPath(request, REQUEST_CHILD_NODE, PROTECTED_PATH); +buildExpectationsForRequest(request, REQUEST_CHILD_NODE); AuthenticationInfo authInfo = (AuthenticationInfo) PrivateAccessor.invoke(slingAuthenticator, "getAuthenticationInfo", new Class[]{HttpServletRequest.class, HttpServletResponse.class}, new Object[]{request, Mockito.mock(HttpServletResponse.class)}); @@ -197,7 +197,7 @@ public class SlingAuthenticatorTest { PrivateAccessor.setField(slingAuthenticator, "authHandlerCache", authRequiredCache); final HttpServletRequest request = Mockito.mock(HttpServletRequest.class); -buildExpectationsForRequestPathAndAuthPath(request, REQUEST_CHILD_NODE, PROTECTED_PATH); +buildExpectationsForRequest(request, REQUEST_CHILD_NODE); AuthenticationInfo authInfo = (AuthenticationInfo) PrivateAccessor.invoke(slingAuthenticator, "getAuthenticationInfo", new Class[]{HttpServletRequest.class, HttpServletResponse.class}, new Object[]{request, Mockito.mock(HttpServletResponse.class)}); @@ -220,7 +220,7 @@ public class SlingAuthenticatorTest { PrivateAccessor.setField(slingAuthenticator, "authHandlerCache", authRequiredCache); final HttpServletRequest request = Mockito.mock(HttpServletRequest.class); -buildExpectationsForRequestPathAndAuthPath(request, REQUEST_CHILD_NODE, PROTECTED_PATH); +buildExpectationsForRequest(request, REQUEST_CHILD_NODE); AuthenticationInfo authInfo = (AuthenticationInfo) PrivateAccessor.invoke(slingAuthenticator, "getAuthenticationInfo", new Class[]{HttpServletRequest.class, HttpServletResponse.class}, new Object[]{request, Mockito.mock(HttpServletResponse.class)}); @@ -246,7 +246,7 @@ public class SlingAuthenticatorTest { PrivateAccessor.setField(slingAuthenticator, "authHandlerCache", authRequiredCache); final HttpServletRequest request = Mockito.mock(HttpServletRequest.class); -buildExpectationsForRequestPathAndAuthPath(request, REQUEST_CHILD_NODE, PROTECTED_PATH); +buildExpectationsForRequest(request, REQUEST_CHILD_NODE); AuthenticationInfo authInfo = (AuthenticationInfo) P
[sling-org-apache-sling-auth-core] branch bugfix/cleanup-unit-test created (now c03b9a8)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch bugfix/cleanup-unit-test in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-auth-core.git. at c03b9a8 Cleanup unit test This branch includes the following new commits: new c03b9a8 Cleanup unit test The 1 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.
[sling-org-apache-sling-api] branch feature/SLING-9745-ResourceUri-Api updated (31fb59a -> 11c0a62)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9745-ResourceUri-Api in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git. from 31fb59a SLING-9745 Avoid introducing runtime dependency to StringUtils add a62f388 SLING-9745 Renamed method isFullUri() to isAbsolute() to be in line with JDK URI class and removed default impl in interface. Added @ProviderType annotations add 11c0a62 SLING-9745 Improve javadoc and add Nullable/NotNull annotations No new revisions were added by this update. Summary of changes: .../apache/sling/api/resource/uri/ResourceUri.java | 173 +++ .../sling/api/resource/uri/ResourceUriBuilder.java | 323 +++-- .../sling/api/resource/uri/ResourceUriTest.java| 23 +- 3 files changed, 355 insertions(+), 164 deletions(-)
[sling-org-apache-sling-api] branch feature/SLING-9745-ResourceUri-Api updated (8771430 -> 31fb59a)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9745-ResourceUri-Api in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git. from 8771430 SLING-9745 Improved javadoc and added some more java URI compatibility checks add 31fb59a SLING-9745 Avoid introducing runtime dependency to StringUtils No new revisions were added by this update. Summary of changes: pom.xml| 1 + .../apache/sling/api/resource/uri/ResourceUri.java | 4 ++-- .../sling/api/resource/uri/ResourceUriBuilder.java | 28 +- 3 files changed, 20 insertions(+), 13 deletions(-)
[sling-org-apache-sling-api] branch feature/SLING-9745-ResourceUri-Api updated (b1b44e1 -> 8771430)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9745-ResourceUri-Api in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git. from b1b44e1 SLING-9745 Ensure getSchemeSpecificPart() matches to java URI impl add 8771430 SLING-9745 Improved javadoc and added some more java URI compatibility checks No new revisions were added by this update. Summary of changes: .../apache/sling/api/resource/uri/ResourceUri.java | 22 +- .../sling/api/resource/uri/ResourceUriTest.java| 10 +++--- 2 files changed, 20 insertions(+), 12 deletions(-)
[sling-org-apache-sling-api] branch feature/SLING-9745-ResourceUri-Api updated (bc65bfd -> b1b44e1)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9745-ResourceUri-Api in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git. from bc65bfd SLING-9745 ResourceUri improvements from code review add b1b44e1 SLING-9745 Ensure getSchemeSpecificPart() matches to java URI impl No new revisions were added by this update. Summary of changes: .../apache/sling/api/resource/uri/ResourceUri.java | 5 ++--- .../sling/api/resource/uri/ResourceUriBuilder.java | 24 +++--- .../ResourceUriBuilderWithAdjustMethodTest.java| 2 +- .../sling/api/resource/uri/ResourceUriTest.java| 21 +-- 4 files changed, 25 insertions(+), 27 deletions(-)
[sling-org-apache-sling-api] branch feature/SLING-9745-ResourceUri-Api updated (4b6c809 -> bc65bfd)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9745-ResourceUri-Api in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git. from 4b6c809 SLING-9745 Introduce ResourceUri (immutable) and ResourceUriBuilder add bc65bfd SLING-9745 ResourceUri improvements from code review No new revisions were added by this update. Summary of changes: .../apache/sling/api/resource/uri/ResourceUri.java | 3 +++ .../sling/api/resource/uri/ResourceUriBuilder.java | 24 ++ .../api/resource/uri/ResourceUriBuilderTest.java | 9 3 files changed, 28 insertions(+), 8 deletions(-)
[sling-org-apache-sling-api] branch feature/SLING-9745-ResourceUri-Api updated (298ed53 -> 4b6c809)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9745-ResourceUri-Api in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git. discard 298ed53 SLING-9745 Introduce ResourceUri (immutable) and ResourceUriBuilder add 4b6c809 SLING-9745 Introduce ResourceUri (immutable) and ResourceUriBuilder This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (298ed53) \ N -- N -- N refs/heads/feature/SLING-9745-ResourceUri-Api (4b6c809) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. No new revisions were added by this update. Summary of changes: .../org/apache/sling/api/resource/uri/ResourceUriBuilder.java | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-)
[sling-org-apache-sling-api] 01/01: SLING-9745 Introduce ResourceUri (immutable) and ResourceUriBuilder
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch feature/SLING-9745-ResourceUri-Api in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git commit 298ed530c6bbd6bcc828c1c9c80790d9919c7f43 Author: georg.henzler AuthorDate: Fri Sep 18 10:41:15 2020 +0200 SLING-9745 Introduce ResourceUri (immutable) and ResourceUriBuilder General purpose class to represent a ResourceUri (like e.g. a link in an html tag) --- pom.xml| 1 - .../apache/sling/api/resource/uri/ResourceUri.java | 181 + .../sling/api/resource/uri/ResourceUriBuilder.java | 837 + .../sling/api/resource/uri/package-info.java | 23 + .../api/resource/uri/ResourceUriBuilderTest.java | 157 .../ResourceUriBuilderWithAdjustMethodTest.java| 244 ++ .../api/resource/uri/ResourceUriRebaseTest.java| 231 ++ .../sling/api/resource/uri/ResourceUriTest.java| 442 +++ ...UriToSlingRequestPathInfoCompatibilityTest.java | 272 +++ 9 files changed, 2387 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8e02cb7..38e6e92 100644 --- a/pom.xml +++ b/pom.xml @@ -105,7 +105,6 @@ org.apache.commons commons-lang3 3.2 -test org.osgi diff --git a/src/main/java/org/apache/sling/api/resource/uri/ResourceUri.java b/src/main/java/org/apache/sling/api/resource/uri/ResourceUri.java new file mode 100644 index 000..1250215 --- /dev/null +++ b/src/main/java/org/apache/sling/api/resource/uri/ResourceUri.java @@ -0,0 +1,181 @@ +/* + * 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.api.resource.uri; + +import static org.apache.commons.lang3.StringUtils.isBlank; +import static org.apache.commons.lang3.StringUtils.isNotBlank; + +import java.net.URI; +import java.util.Map; +import java.util.function.Consumer; + +import org.apache.sling.api.request.RequestPathInfo; +import org.apache.sling.api.resource.Resource; + +/** + * Represents an immutable URI that points to a resource or alternatively, can contain opaque URIs like {@code mailto:} or + * {@code javascript:}. Use {@link ResourceUri#adjust(Consumer)} or {@link ResourceUriBuilder} to create new or modified instances. + */ +public interface ResourceUri extends RequestPathInfo { + +/** + * @return returns the URI. + */ +public URI toUri(); + +/** + * @return returns the URI as String. + */ +public String toString(); + +/** + * @return returns the scheme of the ResourceUri or null if not set + */ +public String getScheme(); + +/** + * @return returns the user info of the ResourceUri or null if not set + */ +public String getUserInfo(); + +/** + * @return returns the host of the ResourceUri or null if not set + */ +public String getHost(); + +/** + * @return returns the port of the ResourceUri or null if not set + */ +public int getPort(); + +/** + * @return returns the resource path or null if the URI does not contain a path. + */ +@Override +public String getResourcePath(); + +/** + * @return returns the selector string or null if the URI does not contain selector(s) + */ +@Override +public String getSelectorString(); + +/** + * @return returns the selector array (empty if the URI does not contain selector(s)) + */ +@Override +public String[] getSelectors(); + +/** + * @return returns the extension or null if the URI does not contain an extension + */ +@Override +public String getExtension(); + +/** + * @return returns the path parameters or an empty Map if the URI does not contain any + */ +public Map getPathParameters(); + +/** + * @return returns the suffix or null if the URI does not contain a suffix + */ +@Override +public String getSuffix(); + +/** + * @return returns the joint path of resource path, selectors, extension and suffix or null if resource path is not set + */ +p
[sling-org-apache-sling-api] branch feature/SLING-9745-ResourceUri-Api created (now 298ed53)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9745-ResourceUri-Api in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git. at 298ed53 SLING-9745 Introduce ResourceUri (immutable) and ResourceUriBuilder This branch includes the following new commits: new 298ed53 SLING-9745 Introduce ResourceUri (immutable) and ResourceUriBuilder The 1 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.
[sling-org-apache-sling-api] 01/01: SLING-9662 Javadoc, avoid increasing version of package org.apache.sling.api.resource
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch feature/SLING-9662-Introduce-Resource-Mapping-SPI-v2 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git commit 2325681b27413d23c8aa841278aaa6e168104cf0 Author: georg.henzler AuthorDate: Fri Sep 11 11:57:39 2020 +0200 SLING-9662 Javadoc, avoid increasing version of package org.apache.sling.api.resource --- .../resource/mapping/PathToUriMappingService.java | 15 +++-- .../apache/sling/api/resource/package-info.java| 2 +- .../sling/api/resource/uri/ResourceUriBuilder.java | 25 +++--- 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java b/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java index 8134699..0defbc3 100644 --- a/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java +++ b/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java @@ -54,16 +54,17 @@ public interface PathToUriMappingService { Map getIntermediateMappings(); } -/** Resolves a path relative to the given request. +/** Maps a path to a URI * * @param request - * @param path - * @return a @{link PathToUriMappingService.Result} */ -Result resolve(@Nullable HttpServletRequest request, @NotNull String path); - -/** @param request * @param resourcePath * @return a @{link PathToUriMappingService.Result} */ -Result map(@Nullable HttpServletRequest request, @NotNull String resourcePath); +Result map(@Nullable HttpServletRequest exampleRequest, @NotNull String resourcePath); +/** Resolves a path relative to the given request. + * + * @param request + * @param path + * @return a @{link PathToUriMappingService.Result} */ +Result resolve(@Nullable HttpServletRequest request, @Nullable String path); } \ No newline at end of file diff --git a/src/main/java/org/apache/sling/api/resource/package-info.java b/src/main/java/org/apache/sling/api/resource/package-info.java index ac05b61..7bd85e6 100644 --- a/src/main/java/org/apache/sling/api/resource/package-info.java +++ b/src/main/java/org/apache/sling/api/resource/package-info.java @@ -17,7 +17,7 @@ * under the License. */ -@Version("2.13.0") +@Version("2.12.2") package org.apache.sling.api.resource; import org.osgi.annotation.versioning.Version; diff --git a/src/main/java/org/apache/sling/api/resource/uri/ResourceUriBuilder.java b/src/main/java/org/apache/sling/api/resource/uri/ResourceUriBuilder.java index bc9c4c6..4dd3b65 100644 --- a/src/main/java/org/apache/sling/api/resource/uri/ResourceUriBuilder.java +++ b/src/main/java/org/apache/sling/api/resource/uri/ResourceUriBuilder.java @@ -34,6 +34,8 @@ import org.apache.sling.api.SlingHttpServletRequest; import org.apache.sling.api.request.RequestPathInfo; import org.apache.sling.api.resource.Resource; import org.apache.sling.api.resource.ResourceResolver; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class ResourceUriBuilder { @@ -90,7 +92,9 @@ public class ResourceUriBuilder { * @param requestPathInfo * @return a ResourceUriBuilder */ public static ResourceUriBuilder createFrom(RequestPathInfo requestPathInfo) { +Resource suffixResource = requestPathInfo.getSuffixResource(); return create() +.setResourceResolver(suffixResource != null ? suffixResource.getResourceResolver() : null) .setResourcePath(requestPathInfo.getResourcePath()) .setSelectors(requestPathInfo.getSelectors()) .setExtension(requestPathInfo.getExtension()) @@ -106,14 +110,17 @@ public class ResourceUriBuilder { .setResourceResolver(request.getResourceResolver()) .setScheme(request.getScheme()) .setHost(request.getServerName()) -.setPort(request.getServerPort()); +.setPort(request.getServerPort()) +.setQuery(request.getQueryString()); } -/** Creates a builder from a URI. +/** Creates a builder from an arbitrary URI. * - * @param uri + * @param uri the uri to transform to a ResourceUri + * @param resourceResolver a resource resolver is needed to decide up to what part the path is the resource path (that decision is only + *possible by checking against the underlying repository). If null is passed in, the shortest viable resource path is used. * @return a ResourceUriBuilder */ -public static ResourceUriBuilder createFrom(URI uri, ResourceResolver resourceResolver) { +public static ResourceUriBuilder createFrom(@NotNull URI uri, @Nullable ResourceResolver resourceResolver) {
[sling-org-apache-sling-api] branch feature/SLING-9662-Introduce-Resource-Mapping-SPI-v2 updated (8d0fc53 -> 2325681)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9662-Introduce-Resource-Mapping-SPI-v2 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git. discard 8d0fc53 SLING-9662 Javadoc, avoid increasing version of package org.apache.sling.api.resource new 2325681 SLING-9662 Javadoc, avoid increasing version of package org.apache.sling.api.resource This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (8d0fc53) \ N -- N -- N refs/heads/feature/SLING-9662-Introduce-Resource-Mapping-SPI-v2 (2325681) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. The 1 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. Summary of changes: .../org/apache/sling/api/resource/uri/ResourceUriBuilder.java | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-)
[sling-org-apache-sling-resourceresolver] branch feature/SLING-9662-Introduce-Resource-Mapping-SPI-v2 updated: SLING-9662 Allow null path for resolve()
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch feature/SLING-9662-Introduce-Resource-Mapping-SPI-v2 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git The following commit(s) were added to refs/heads/feature/SLING-9662-Introduce-Resource-Mapping-SPI-v2 by this push: new 8e391ad SLING-9662 Allow null path for resolve() 8e391ad is described below commit 8e391ad1783c120862b814848cd2f82801aa3ba2 Author: georg.henzler AuthorDate: Fri Sep 11 12:02:39 2020 +0200 SLING-9662 Allow null path for resolve() --- .../impl/mappingchain/PathToUriMappingServiceImpl.java | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/apache/sling/resourceresolver/impl/mappingchain/PathToUriMappingServiceImpl.java b/src/main/java/org/apache/sling/resourceresolver/impl/mappingchain/PathToUriMappingServiceImpl.java index 4fe3e12..6c0f327 100644 --- a/src/main/java/org/apache/sling/resourceresolver/impl/mappingchain/PathToUriMappingServiceImpl.java +++ b/src/main/java/org/apache/sling/resourceresolver/impl/mappingchain/PathToUriMappingServiceImpl.java @@ -108,7 +108,11 @@ public class PathToUriMappingServiceImpl implements PathToUriMappingService { } @NotNull -public MappingChainResult resolve(@Nullable HttpServletRequest request, @NotNull String path) { +public MappingChainResult resolve(@Nullable HttpServletRequest request, @Nullable String path) { + +if (path == null || path.isEmpty()) { +path = "/"; +} try (ResourceResolver rr = getResourceResolver()) { MappingChainContextInternal mappingContext = new MappingChainContextInternal(rr);
[sling-org-apache-sling-api] branch feature/SLING-9662-Introduce-Resource-Mapping-SPI-v2 updated: SLING-9662 Javadoc, avoid increasing version of package org.apache.sling.api.resource
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch feature/SLING-9662-Introduce-Resource-Mapping-SPI-v2 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git The following commit(s) were added to refs/heads/feature/SLING-9662-Introduce-Resource-Mapping-SPI-v2 by this push: new 8d0fc53 SLING-9662 Javadoc, avoid increasing version of package org.apache.sling.api.resource 8d0fc53 is described below commit 8d0fc53fa636a1e3e4993a3172c31f28fb1ac2e1 Author: georg.henzler AuthorDate: Fri Sep 11 11:57:39 2020 +0200 SLING-9662 Javadoc, avoid increasing version of package org.apache.sling.api.resource --- .../resource/mapping/PathToUriMappingService.java | 15 ++-- .../apache/sling/api/resource/package-info.java| 2 +- .../sling/api/resource/uri/ResourceUriBuilder.java | 27 +++--- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java b/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java index 8134699..0defbc3 100644 --- a/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java +++ b/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java @@ -54,16 +54,17 @@ public interface PathToUriMappingService { Map getIntermediateMappings(); } -/** Resolves a path relative to the given request. +/** Maps a path to a URI * * @param request - * @param path - * @return a @{link PathToUriMappingService.Result} */ -Result resolve(@Nullable HttpServletRequest request, @NotNull String path); - -/** @param request * @param resourcePath * @return a @{link PathToUriMappingService.Result} */ -Result map(@Nullable HttpServletRequest request, @NotNull String resourcePath); +Result map(@Nullable HttpServletRequest exampleRequest, @NotNull String resourcePath); +/** Resolves a path relative to the given request. + * + * @param request + * @param path + * @return a @{link PathToUriMappingService.Result} */ +Result resolve(@Nullable HttpServletRequest request, @Nullable String path); } \ No newline at end of file diff --git a/src/main/java/org/apache/sling/api/resource/package-info.java b/src/main/java/org/apache/sling/api/resource/package-info.java index ac05b61..7bd85e6 100644 --- a/src/main/java/org/apache/sling/api/resource/package-info.java +++ b/src/main/java/org/apache/sling/api/resource/package-info.java @@ -17,7 +17,7 @@ * under the License. */ -@Version("2.13.0") +@Version("2.12.2") package org.apache.sling.api.resource; import org.osgi.annotation.versioning.Version; diff --git a/src/main/java/org/apache/sling/api/resource/uri/ResourceUriBuilder.java b/src/main/java/org/apache/sling/api/resource/uri/ResourceUriBuilder.java index bc9c4c6..8677b2d 100644 --- a/src/main/java/org/apache/sling/api/resource/uri/ResourceUriBuilder.java +++ b/src/main/java/org/apache/sling/api/resource/uri/ResourceUriBuilder.java @@ -34,6 +34,8 @@ import org.apache.sling.api.SlingHttpServletRequest; import org.apache.sling.api.request.RequestPathInfo; import org.apache.sling.api.resource.Resource; import org.apache.sling.api.resource.ResourceResolver; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class ResourceUriBuilder { @@ -90,7 +92,9 @@ public class ResourceUriBuilder { * @param requestPathInfo * @return a ResourceUriBuilder */ public static ResourceUriBuilder createFrom(RequestPathInfo requestPathInfo) { +Resource suffixResource = requestPathInfo.getSuffixResource(); return create() +.setResourceResolver(suffixResource != null ? suffixResource.getResourceResolver() : null) .setResourcePath(requestPathInfo.getResourcePath()) .setSelectors(requestPathInfo.getSelectors()) .setExtension(requestPathInfo.getExtension()) @@ -106,14 +110,18 @@ public class ResourceUriBuilder { .setResourceResolver(request.getResourceResolver()) .setScheme(request.getScheme()) .setHost(request.getServerName()) -.setPort(request.getServerPort()); +.setPort(request.getServerPort()) +.setQuery(request.getQueryString()); } -/** Creates a builder from a URI. +/** Creates a builder from an arbitrary URI. * - * @param uri + * @param uri the uri to transform to a ResourceUri + * @param resourceResolver a resource resolver is needed to decide what up to what part the path is the resource path (that decision is + *only possible by checking against the underlying repository). If null is passed in, the shortest viable resource path is +
[sling-org-apache-sling-resourceresolver] branch feature/SLING-9662-Introduce-Resource-Mapping-SPI-v2 created (now de835ae)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9662-Introduce-Resource-Mapping-SPI-v2 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git. at de835ae SLING-9662 Introduce Resource Mapping SPI This branch includes the following new commits: new de835ae SLING-9662 Introduce Resource Mapping SPI The 1 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.
[sling-org-apache-sling-resourceresolver] 01/01: SLING-9662 Introduce Resource Mapping SPI
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch feature/SLING-9662-Introduce-Resource-Mapping-SPI-v2 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git commit de835ae65bc4e8b5b6955ee5e679706e0e0a2adf Author: georg.henzler AuthorDate: Fri Aug 14 07:36:58 2020 +0200 SLING-9662 Introduce Resource Mapping SPI --- pom.xml| 2 +- .../impl/CommonResourceResolverFactoryImpl.java| 9 +- .../impl/ResourceResolverFactoryActivator.java | 9 + .../impl/ResourceResolverImpl.java | 7 +- .../impl/mapping/ResourceMapperImpl.java | 23 ++- .../mappingchain/MappingChainContextInternal.java | 82 + .../impl/mappingchain/MappingChainResult.java | 53 ++ .../mappingchain/PathToUriMappingServiceImpl.java | 193 + .../defaultmappers/BasePathMapper.java | 83 + .../defaultmappers/EnsureHtmlExtensionMapper.java | 80 + .../impl/EtcMappingResourceResolverTest.java | 56 +++--- .../impl/MockedResourceResolverImplTest.java | 9 +- .../resourceresolver/impl/ProviderHandlerTest.java | 2 + .../impl/ResourceDecoratorTestBase.java| 7 + .../impl/ResourceResolverImplTest.java | 2 + .../impl/ResourceResolverMangleNamespacesTest.java | 11 +- .../mapping/AbstractMappingMapEntriesTest.java | 51 +++--- .../impl/mapping/EtcMappingMapEntriesTest.java | 38 ++-- .../impl/mapping/ResourceMapperImplTest.java | 3 + .../sling/resourceresolver/util/MockTestUtil.java | 48 +++-- .../util/TestPathToUriMappingService.java | 65 +++ 21 files changed, 732 insertions(+), 101 deletions(-) diff --git a/pom.xml b/pom.xml index b056ab6..118a877 100644 --- a/pom.xml +++ b/pom.xml @@ -106,7 +106,7 @@ org.apache.sling org.apache.sling.api -2.21.0 +2.23.0-SNAPSHOT provided diff --git a/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java b/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java index b925e65..4e423c2 100644 --- a/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java +++ b/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java @@ -31,12 +31,11 @@ import java.util.Stack; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicBoolean; -import org.jetbrains.annotations.NotNull; - import org.apache.commons.collections4.BidiMap; import org.apache.sling.api.resource.LoginException; import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.mapping.PathToUriMappingService; import org.apache.sling.api.resource.path.Path; import org.apache.sling.resourceresolver.impl.console.ResourceResolverWebConsolePlugin; import org.apache.sling.resourceresolver.impl.helper.ResourceDecoratorTracker; @@ -48,6 +47,7 @@ import org.apache.sling.resourceresolver.impl.mapping.Mapping; import org.apache.sling.resourceresolver.impl.providers.ResourceProviderTracker; import org.apache.sling.serviceusermapping.ServiceUserMapper; import org.apache.sling.spi.resource.provider.ResourceProvider; +import org.jetbrains.annotations.NotNull; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.slf4j.Logger; @@ -405,6 +405,11 @@ public class CommonResourceResolverFactoryImpl implements ResourceResolverFactor return this.activator.getResourceAccessSecurityTracker(); } +/** gets PathToUriMappingServiceImpl */ +public PathToUriMappingService getPathToUriMappingService() { +return this.activator.getPathToUriMappingService(); +} + @NotNull @Override public ResourceResolver getServiceResourceResolver( diff --git a/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java b/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java index 646a077..6de579a 100644 --- a/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java +++ b/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java @@ -34,9 +34,11 @@ import org.apache.commons.collections4.BidiMap; import org.apache.commons.collections4.bidimap.TreeBidiMap; import org.apache.sling.api.resource.ResourceDecorator; import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.mapping.PathToUriMappingService; import org.apache.sling.api.resource.path.Path; import org.apache.sling.api.resource.runtime.RuntimeService; import
[sling-org-apache-sling-engine] branch feature/SLING-9662-Introduce-Resource-Mapping-SPI-v2 created (now 203f9a8)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9662-Introduce-Resource-Mapping-SPI-v2 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-engine.git. at 203f9a8 SLING-9662 Use Resource Mapping API for resolving This branch includes the following new commits: new 203f9a8 SLING-9662 Use Resource Mapping API for resolving The 1 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.
[sling-org-apache-sling-engine] 01/01: SLING-9662 Use Resource Mapping API for resolving
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch feature/SLING-9662-Introduce-Resource-Mapping-SPI-v2 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-engine.git commit 203f9a85a101749c070ea8c3d76ef194c8056b73 Author: georg.henzler AuthorDate: Thu Sep 10 15:51:09 2020 +0200 SLING-9662 Use Resource Mapping API for resolving --- pom.xml| 2 +- .../apache/sling/engine/impl/SlingMainServlet.java | 19 -- .../engine/impl/SlingRequestProcessorImpl.java | 34 ++ .../sling/engine/impl/request/RequestData.java | 40 +++--- .../engine/impl/request/InitResourceTest.java | 16 + 5 files changed, 82 insertions(+), 29 deletions(-) diff --git a/pom.xml b/pom.xml index 83d0419..bcc1606 100644 --- a/pom.xml +++ b/pom.xml @@ -111,7 +111,7 @@ org.apache.sling org.apache.sling.api -2.6.0 +2.23.0-SNAPSHOT provided diff --git a/src/main/java/org/apache/sling/engine/impl/SlingMainServlet.java b/src/main/java/org/apache/sling/engine/impl/SlingMainServlet.java index d1e3add..f48af22 100644 --- a/src/main/java/org/apache/sling/engine/impl/SlingMainServlet.java +++ b/src/main/java/org/apache/sling/engine/impl/SlingMainServlet.java @@ -37,6 +37,7 @@ import javax.servlet.http.HttpServletResponse; import org.apache.sling.api.adapter.AdapterManager; import org.apache.sling.api.request.SlingRequestEvent; import org.apache.sling.api.resource.ResourceResolver; +import org.apache.sling.api.resource.mapping.PathToUriMappingService; import org.apache.sling.api.servlets.ServletResolver; import org.apache.sling.auth.core.AuthenticationSupport; import org.apache.sling.commons.mime.MimeTypeService; @@ -142,6 +143,9 @@ public class SlingMainServlet extends GenericServlet { @Reference(cardinality = ReferenceCardinality.OPTIONAL, policy = ReferencePolicy.DYNAMIC, policyOption = ReferencePolicyOption.GREEDY) private volatile RequestListenerManager requestListenerManager; +@Reference +private volatile PathToUriMappingService pathToUriMappingService; + private BundleContext bundleContext; /** default log */ @@ -231,6 +235,9 @@ public class SlingMainServlet extends GenericServlet { localRLM.sendEvent(request, SlingRequestEvent.EventType.EVENT_INIT); } +final RequestData requestData = new RequestData(requestProcessor, request, (HttpServletResponse) res); +requestData.initResourceUri(); + ResourceResolver resolver = null; try { if (!allowTrace && "TRACE".equals(request.getMethod())) { @@ -247,8 +254,7 @@ public class SlingMainServlet extends GenericServlet { : null; // real request handling for HTTP requests -requestProcessor.doProcessRequest(request, (HttpServletResponse) res, -resolver); +requestProcessor.doProcessRequest(request, (HttpServletResponse) res, resolver, requestData); } catch (ClientAbortException cae) { log.debug("service: ClientAbortException, probable cause is client aborted request or network problem", cae); @@ -601,6 +607,15 @@ public class SlingMainServlet extends GenericServlet { public void unsetMimeTypeService(final MimeTypeService mimeTypeService) { slingHttpContext.unsetMimeTypeService(mimeTypeService); } + +@Reference(name = "PathToUriMappingService", cardinality = ReferenceCardinality.OPTIONAL, policy = ReferencePolicy.DYNAMIC, unbind = "unsetPathToUriMappingService") +public void setPathToUriMappingService(final PathToUriMappingService pathToUriMappingService) { +requestProcessor.setPathToUriMappingService(pathToUriMappingService); +} + +public void unsetPathToUriMappingService(final PathToUriMappingService pathToUriMappingService) { +requestProcessor.unsetPathToUriMappingService(pathToUriMappingService); +} @Reference(name = "AuthenticationSupport", cardinality = ReferenceCardinality.OPTIONAL, policy = ReferencePolicy.DYNAMIC, unbind = "unsetAuthenticationSupport") public void setAuthenticationSupport( diff --git a/src/main/java/org/apache/sling/engine/impl/SlingRequestProcessorImpl.java b/src/main/java/org/apache/sling/engine/impl/SlingRequestProcessorImpl.java index d70283b..54f814d 100644 --- a/src/main/java/org/apache/sling/engine/impl/SlingRequestProcessorImpl.java +++ b/src/main/java/org/apache/sling/engine/impl/SlingRequestProcessorImpl.java @@ -44,6 +44,8 @@ import org.apache.sling.api.request.RequestPathInfo; import org.apache.sling.api.resource.Resource; import org.apache.sling.api.resource.ResourceNotFoundExcept
[sling-org-apache-sling-api] branch feature/SLING-9662-Introduce-Resource-Mapping-SPI-v2 created (now c27db47)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9662-Introduce-Resource-Mapping-SPI-v2 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git. at c27db47 SLING-9662 Introduce Resource Mapping SPI incl. ResourceUri This branch includes the following new commits: new c27db47 SLING-9662 Introduce Resource Mapping SPI incl. ResourceUri The 1 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.
[sling-org-apache-sling-api] 01/01: SLING-9662 Introduce Resource Mapping SPI incl. ResourceUri
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch feature/SLING-9662-Introduce-Resource-Mapping-SPI-v2 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git commit c27db47a07ce7d85896e1c761f462653a7532e79 Author: georg.henzler AuthorDate: Mon Sep 7 16:01:00 2020 +0200 SLING-9662 Introduce Resource Mapping SPI incl. ResourceUri --- pom.xml| 2 +- .../sling/api/resource/ResourceResolver.java | 6 +- .../resource/mapping/PathToUriMappingService.java | 69 +++ .../sling/api/resource/mapping/package-info.java | 2 +- .../apache/sling/api/resource/package-info.java| 2 +- .../apache/sling/api/resource/uri/ResourceUri.java | 122 .../sling/api/resource/uri/ResourceUriBuilder.java | 607 ++ .../sling/api/resource/{ => uri}/package-info.java | 5 +- .../spi/resource/mapping/MappingChainContext.java | 51 ++ .../spi/resource/mapping/ResourceUriMapper.java| 56 ++ .../resource/mapping/package-info.java | 4 +- .../sling/api/resource/uri/ResourceUriTest.java| 679 + ...UriToSlingRequestPathInfoCompatibilityTest.java | 271 13 files changed, 1866 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index 8e02cb7..10f3109 100644 --- a/pom.xml +++ b/pom.xml @@ -105,7 +105,7 @@ org.apache.commons commons-lang3 3.2 -test + org.osgi diff --git a/src/main/java/org/apache/sling/api/resource/ResourceResolver.java b/src/main/java/org/apache/sling/api/resource/ResourceResolver.java index 8a2b27d..e92abe0 100644 --- a/src/main/java/org/apache/sling/api/resource/ResourceResolver.java +++ b/src/main/java/org/apache/sling/api/resource/ResourceResolver.java @@ -22,12 +22,14 @@ import java.io.Closeable; import java.util.Iterator; import java.util.Map; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.annotations.NotNull; import javax.servlet.http.HttpServletRequest; import org.apache.sling.api.adapter.Adaptable; import org.apache.sling.api.resource.mapping.ResourceMapper; +import org.apache.sling.api.resource.uri.ResourceUri; +import org.apache.sling.api.resource.uri.ResourceUriBuilder; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.osgi.annotation.versioning.ProviderType; /** diff --git a/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java b/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java new file mode 100644 index 000..8134699 --- /dev/null +++ b/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java @@ -0,0 +1,69 @@ +/* + * 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.api.resource.mapping; + +import java.util.Map; +import java.util.Set; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.sling.api.resource.uri.ResourceUri; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.osgi.annotation.versioning.ProviderType; + +/** Provides a way to resolve URIs to resource paths and map resource paths to URIs. */ +@ProviderType +public interface PathToUriMappingService { + +/** A context hint for a consumer of the map/resolve result */ +@ProviderType +public interface ContextHint { +String getName(); +} + +/** The result of a map or resolve operation */ +@ProviderType +public interface Result { +/** @return the ResourceUri */ +@NotNull +ResourceUri getResourceUri(); + +/** @return context hints (e.g. 'invalid link' for map(), or 'requires authentication' for resolve()) */ +@NotNull +Set getContextHints(); + +/** @return all intermediate mappings as produced by {@link org.apache.sling.spi.resource.mapping.ResourceUriMapper} services. */ +@NotNull +Map getIntermediateMappings(); +} + +/** Resolves a path relative to the giv
[sling-org-apache-sling-resourceresolver] 01/01: SLING-9662 Introduce Resource Mapping SPI
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch feature/SLING-9662-Introduce-Resource-Mapping-SPI in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git commit 9a703ac38bee64c6ebe73b5c4df3b56307fdaed0 Author: georg.henzler AuthorDate: Fri Aug 14 07:36:58 2020 +0200 SLING-9662 Introduce Resource Mapping SPI --- pom.xml| 2 +- .../impl/CommonResourceResolverFactoryImpl.java| 9 +- .../impl/ResourceResolverFactoryActivator.java | 9 ++ .../impl/ResourceResolverImpl.java | 8 +- .../impl/mapping/ResourceMapperImpl.java | 18 ++- .../mappingchain/MappingChainContextInternal.java | 69 ++ .../impl/mappingchain/MappingChainResult.java | 45 +++ .../impl/mappingchain/ResourceUriMappingChain.java | 141 + .../defaultmappers/BasePathMapper.java | 78 .../defaultmappers/EnsureHtmlExtensionMapper.java | 80 .../impl/EtcMappingResourceResolverTest.java | 3 + .../impl/MockedResourceResolverImplTest.java | 8 +- .../resourceresolver/impl/ProviderHandlerTest.java | 2 + .../impl/ResourceDecoratorTestBase.java| 6 + .../impl/ResourceResolverImplTest.java | 2 + .../impl/ResourceResolverMangleNamespacesTest.java | 6 + .../mapping/AbstractMappingMapEntriesTest.java | 51 .../impl/mapping/EtcMappingMapEntriesTest.java | 4 +- .../impl/mapping/ResourceMapperImplTest.java | 2 + 19 files changed, 509 insertions(+), 34 deletions(-) diff --git a/pom.xml b/pom.xml index 970114c..1acd887 100644 --- a/pom.xml +++ b/pom.xml @@ -106,7 +106,7 @@ org.apache.sling org.apache.sling.api -2.21.0 +2.23.0-SNAPSHOT provided diff --git a/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java b/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java index b925e65..c35bef3 100644 --- a/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java +++ b/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java @@ -31,8 +31,6 @@ import java.util.Stack; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicBoolean; -import org.jetbrains.annotations.NotNull; - import org.apache.commons.collections4.BidiMap; import org.apache.sling.api.resource.LoginException; import org.apache.sling.api.resource.ResourceResolver; @@ -45,9 +43,11 @@ import org.apache.sling.resourceresolver.impl.mapping.MapConfigurationProvider; import org.apache.sling.resourceresolver.impl.mapping.MapEntries; import org.apache.sling.resourceresolver.impl.mapping.MapEntriesHandler; import org.apache.sling.resourceresolver.impl.mapping.Mapping; +import org.apache.sling.resourceresolver.impl.mappingchain.ResourceUriMappingChain; import org.apache.sling.resourceresolver.impl.providers.ResourceProviderTracker; import org.apache.sling.serviceusermapping.ServiceUserMapper; import org.apache.sling.spi.resource.provider.ResourceProvider; +import org.jetbrains.annotations.NotNull; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.slf4j.Logger; @@ -405,6 +405,11 @@ public class CommonResourceResolverFactoryImpl implements ResourceResolverFactor return this.activator.getResourceAccessSecurityTracker(); } +/** gets ResourceUriMappingChain */ +public ResourceUriMappingChain getResourceUriMappingChain() { +return this.activator.getResourceUriMappingChain(); +} + @NotNull @Override public ResourceResolver getServiceResourceResolver( diff --git a/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java b/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java index 646a077..b38310a 100644 --- a/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java +++ b/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java @@ -37,8 +37,10 @@ import org.apache.sling.api.resource.ResourceResolverFactory; import org.apache.sling.api.resource.path.Path; import org.apache.sling.api.resource.runtime.RuntimeService; import org.apache.sling.resourceresolver.impl.helper.ResourceDecoratorTracker; +import org.apache.sling.resourceresolver.impl.mapping.MapEntries; import org.apache.sling.resourceresolver.impl.mapping.Mapping; import org.apache.sling.resourceresolver.impl.mapping.StringInterpolationProvider; +import org.apache.sling.resourceresolver.impl.mappingchain.ResourceUriMappingChain; import
[sling-org-apache-sling-resourceresolver] branch feature/SLING-9662-Introduce-Resource-Mapping-SPI updated (83bb093 -> 9a703ac)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9662-Introduce-Resource-Mapping-SPI in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git. discard 83bb093 SLING-9662 Introduce Resource Mapping SPI new 9a703ac SLING-9662 Introduce Resource Mapping SPI This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (83bb093) \ N -- N -- N refs/heads/feature/SLING-9662-Introduce-Resource-Mapping-SPI (9a703ac) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. The 1 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. Summary of changes: .../impl/mappingchain/TestServlet.java | 88 -- 1 file changed, 88 deletions(-) delete mode 100644 src/main/java/org/apache/sling/resourceresolver/impl/mappingchain/TestServlet.java
[sling-org-apache-sling-resourceresolver] 01/01: SLING-9662 Introduce Resource Mapping SPI
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch feature/SLING-9662-Introduce-Resource-Mapping-SPI in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git commit 83bb093a3faa8bfef48092064f836fd9bb00a4f9 Author: georg.henzler AuthorDate: Fri Aug 14 07:36:58 2020 +0200 SLING-9662 Introduce Resource Mapping SPI --- pom.xml| 2 +- .../impl/CommonResourceResolverFactoryImpl.java| 9 +- .../impl/ResourceResolverFactoryActivator.java | 9 ++ .../impl/ResourceResolverImpl.java | 8 +- .../impl/mapping/ResourceMapperImpl.java | 18 ++- .../mappingchain/MappingChainContextInternal.java | 69 ++ .../impl/mappingchain/MappingChainResult.java | 45 +++ .../impl/mappingchain/ResourceUriMappingChain.java | 141 + .../impl/mappingchain/TestServlet.java | 88 + .../defaultmappers/BasePathMapper.java | 78 .../defaultmappers/EnsureHtmlExtensionMapper.java | 80 .../impl/EtcMappingResourceResolverTest.java | 3 + .../impl/MockedResourceResolverImplTest.java | 8 +- .../resourceresolver/impl/ProviderHandlerTest.java | 2 + .../impl/ResourceDecoratorTestBase.java| 6 + .../impl/ResourceResolverImplTest.java | 2 + .../impl/ResourceResolverMangleNamespacesTest.java | 6 + .../mapping/AbstractMappingMapEntriesTest.java | 51 .../impl/mapping/EtcMappingMapEntriesTest.java | 4 +- .../impl/mapping/ResourceMapperImplTest.java | 2 + 20 files changed, 597 insertions(+), 34 deletions(-) diff --git a/pom.xml b/pom.xml index 970114c..1acd887 100644 --- a/pom.xml +++ b/pom.xml @@ -106,7 +106,7 @@ org.apache.sling org.apache.sling.api -2.21.0 +2.23.0-SNAPSHOT provided diff --git a/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java b/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java index b925e65..c35bef3 100644 --- a/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java +++ b/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java @@ -31,8 +31,6 @@ import java.util.Stack; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicBoolean; -import org.jetbrains.annotations.NotNull; - import org.apache.commons.collections4.BidiMap; import org.apache.sling.api.resource.LoginException; import org.apache.sling.api.resource.ResourceResolver; @@ -45,9 +43,11 @@ import org.apache.sling.resourceresolver.impl.mapping.MapConfigurationProvider; import org.apache.sling.resourceresolver.impl.mapping.MapEntries; import org.apache.sling.resourceresolver.impl.mapping.MapEntriesHandler; import org.apache.sling.resourceresolver.impl.mapping.Mapping; +import org.apache.sling.resourceresolver.impl.mappingchain.ResourceUriMappingChain; import org.apache.sling.resourceresolver.impl.providers.ResourceProviderTracker; import org.apache.sling.serviceusermapping.ServiceUserMapper; import org.apache.sling.spi.resource.provider.ResourceProvider; +import org.jetbrains.annotations.NotNull; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.slf4j.Logger; @@ -405,6 +405,11 @@ public class CommonResourceResolverFactoryImpl implements ResourceResolverFactor return this.activator.getResourceAccessSecurityTracker(); } +/** gets ResourceUriMappingChain */ +public ResourceUriMappingChain getResourceUriMappingChain() { +return this.activator.getResourceUriMappingChain(); +} + @NotNull @Override public ResourceResolver getServiceResourceResolver( diff --git a/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java b/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java index 646a077..b38310a 100644 --- a/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java +++ b/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java @@ -37,8 +37,10 @@ import org.apache.sling.api.resource.ResourceResolverFactory; import org.apache.sling.api.resource.path.Path; import org.apache.sling.api.resource.runtime.RuntimeService; import org.apache.sling.resourceresolver.impl.helper.ResourceDecoratorTracker; +import org.apache.sling.resourceresolver.impl.mapping.MapEntries; import org.apache.sling.resourceresolver.impl.mapping.Mapping; import org.apache.sling.resourceresolver.impl.mapping.StringInterpolationProvider; +import org.apache.sling.resourceresolver.impl.mappingchain.ResourceUriMappingChain
[sling-org-apache-sling-resourceresolver] branch feature/SLING-9662-Introduce-Resource-Mapping-SPI created (now 83bb093)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9662-Introduce-Resource-Mapping-SPI in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git. at 83bb093 SLING-9662 Introduce Resource Mapping SPI This branch includes the following new commits: new 83bb093 SLING-9662 Introduce Resource Mapping SPI The 1 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.
[sling-org-apache-sling-resourceresolver] branch feature/SLING-9662-Introduce-Resource-Mapping-SPI created (now 83bb093)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9662-Introduce-Resource-Mapping-SPI in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git. at 83bb093 SLING-9662 Introduce Resource Mapping SPI This branch includes the following new commits: new 83bb093 SLING-9662 Introduce Resource Mapping SPI The 1 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.
[sling-org-apache-sling-resourceresolver] 01/01: SLING-9662 Introduce Resource Mapping SPI
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a commit to branch feature/SLING-9662-Introduce-Resource-Mapping-SPI in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git commit 83bb093a3faa8bfef48092064f836fd9bb00a4f9 Author: georg.henzler AuthorDate: Fri Aug 14 07:36:58 2020 +0200 SLING-9662 Introduce Resource Mapping SPI --- pom.xml| 2 +- .../impl/CommonResourceResolverFactoryImpl.java| 9 +- .../impl/ResourceResolverFactoryActivator.java | 9 ++ .../impl/ResourceResolverImpl.java | 8 +- .../impl/mapping/ResourceMapperImpl.java | 18 ++- .../mappingchain/MappingChainContextInternal.java | 69 ++ .../impl/mappingchain/MappingChainResult.java | 45 +++ .../impl/mappingchain/ResourceUriMappingChain.java | 141 + .../impl/mappingchain/TestServlet.java | 88 + .../defaultmappers/BasePathMapper.java | 78 .../defaultmappers/EnsureHtmlExtensionMapper.java | 80 .../impl/EtcMappingResourceResolverTest.java | 3 + .../impl/MockedResourceResolverImplTest.java | 8 +- .../resourceresolver/impl/ProviderHandlerTest.java | 2 + .../impl/ResourceDecoratorTestBase.java| 6 + .../impl/ResourceResolverImplTest.java | 2 + .../impl/ResourceResolverMangleNamespacesTest.java | 6 + .../mapping/AbstractMappingMapEntriesTest.java | 51 .../impl/mapping/EtcMappingMapEntriesTest.java | 4 +- .../impl/mapping/ResourceMapperImplTest.java | 2 + 20 files changed, 597 insertions(+), 34 deletions(-) diff --git a/pom.xml b/pom.xml index 970114c..1acd887 100644 --- a/pom.xml +++ b/pom.xml @@ -106,7 +106,7 @@ org.apache.sling org.apache.sling.api -2.21.0 +2.23.0-SNAPSHOT provided diff --git a/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java b/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java index b925e65..c35bef3 100644 --- a/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java +++ b/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java @@ -31,8 +31,6 @@ import java.util.Stack; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicBoolean; -import org.jetbrains.annotations.NotNull; - import org.apache.commons.collections4.BidiMap; import org.apache.sling.api.resource.LoginException; import org.apache.sling.api.resource.ResourceResolver; @@ -45,9 +43,11 @@ import org.apache.sling.resourceresolver.impl.mapping.MapConfigurationProvider; import org.apache.sling.resourceresolver.impl.mapping.MapEntries; import org.apache.sling.resourceresolver.impl.mapping.MapEntriesHandler; import org.apache.sling.resourceresolver.impl.mapping.Mapping; +import org.apache.sling.resourceresolver.impl.mappingchain.ResourceUriMappingChain; import org.apache.sling.resourceresolver.impl.providers.ResourceProviderTracker; import org.apache.sling.serviceusermapping.ServiceUserMapper; import org.apache.sling.spi.resource.provider.ResourceProvider; +import org.jetbrains.annotations.NotNull; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.slf4j.Logger; @@ -405,6 +405,11 @@ public class CommonResourceResolverFactoryImpl implements ResourceResolverFactor return this.activator.getResourceAccessSecurityTracker(); } +/** gets ResourceUriMappingChain */ +public ResourceUriMappingChain getResourceUriMappingChain() { +return this.activator.getResourceUriMappingChain(); +} + @NotNull @Override public ResourceResolver getServiceResourceResolver( diff --git a/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java b/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java index 646a077..b38310a 100644 --- a/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java +++ b/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java @@ -37,8 +37,10 @@ import org.apache.sling.api.resource.ResourceResolverFactory; import org.apache.sling.api.resource.path.Path; import org.apache.sling.api.resource.runtime.RuntimeService; import org.apache.sling.resourceresolver.impl.helper.ResourceDecoratorTracker; +import org.apache.sling.resourceresolver.impl.mapping.MapEntries; import org.apache.sling.resourceresolver.impl.mapping.Mapping; import org.apache.sling.resourceresolver.impl.mapping.StringInterpolationProvider; +import org.apache.sling.resourceresolver.impl.mappingchain.ResourceUriMappingChain
[sling-org-apache-sling-resourceresolver] branch feature/SLING-9662-Introduce-Resource-Mapping-SPI created (now 83bb093)
This is an automated email from the ASF dual-hosted git repository. ghenzler pushed a change to branch feature/SLING-9662-Introduce-Resource-Mapping-SPI in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git. at 83bb093 SLING-9662 Introduce Resource Mapping SPI This branch includes the following new commits: new 83bb093 SLING-9662 Introduce Resource Mapping SPI The 1 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.