incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r722453 - /incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver2.java
Date Tue, 02 Dec 2008 13:26:35 GMT
Author: fmeschbe
Date: Tue Dec  2 05:26:35 2008
New Revision: 722453

URL: http://svn.apache.org/viewvc?rev=722453&view=rev
Log:
SLING-750 Fix several flaws in taking over existing configuration
(see issue for details)

Modified:
    incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver2.java

Modified: incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver2.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver2.java?rev=722453&r1=722452&r2=722453&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver2.java
(original)
+++ incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver2.java
Tue Dec  2 05:26:35 2008
@@ -77,7 +77,7 @@
 
     private static final String MANGLE_NAMESPACE_OUT = "/([^:]+):";
 
-    private static final String ANY_SCHEME_HOST = ".*/.*";
+    private static final String ANY_SCHEME_HOST = "[^/]+/[^/]+";
 
     private static final String MAP_ROOT = "/etc/map";
 
@@ -695,9 +695,14 @@
         Map<?, ?> virtuals = factory.getVirtualURLMap();
         if (virtuals != null) {
             for (Entry<?, ?> virtualEntry : virtuals.entrySet()) {
-                String url = ANY_SCHEME_HOST + virtualEntry.getKey();
-                String redirect = (String) virtualEntry.getValue();
-                entries.add(new MapEntry(url, redirect, -1));
+                String extPath = (String) virtualEntry.getKey();
+                String intPath = (String) virtualEntry.getValue();
+                if (!extPath.equals(intPath)) {
+                    // this regular expression must match the whole URL !!
+                    String url = "^" + ANY_SCHEME_HOST + extPath + "$";
+                    String redirect = intPath;
+                    entries.add(new MapEntry(url, redirect, -1));
+                }
             }
         }
         
@@ -707,8 +712,8 @@
             Map<String, List<String>> map = new HashMap<String, List<String>>();
             for (Mapping mapping : mappings) {
                 if (mapping.mapsInbound()) {
-                    String url = mapping.getFrom();
-                    String alias = mapping.getTo();
+                    String url = mapping.getTo();
+                    String alias = mapping.getFrom();
                     if (url.length() > 0) {
                         List<String> aliasList = map.get(url);
                         if (aliasList == null) {



Mime
View raw message