You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2008/10/08 14:28:25 UTC

svn commit: r702834 - /incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java

Author: cziegeler
Date: Wed Oct  8 05:28:24 2008
New Revision: 702834

URL: http://svn.apache.org/viewvc?rev=702834&view=rev
Log:
Default to html for vanity urls.

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

Modified: incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java?rev=702834&r1=702833&r2=702834&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java (original)
+++ incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java Wed Oct  8 05:28:24 2008
@@ -291,7 +291,7 @@
                 String path = rm.getResolutionPath();
                 String uriPath = mappings[i].mapHandle(path);
                 if (uriPath != null && !uriPath.equals(path)) {
-                    resource.getResourceMetadata().setResolutionPath(uriPath);
+                    rm.setResolutionPath(uriPath);
                 }
 
                 return resource;
@@ -307,12 +307,17 @@
             final Resource resource = searchVanityPath(curPath);
             if ( resource != null ) {
                 final ResourceMetadata rm = resource.getResourceMetadata();
-                String rpi = uri.substring(curPath.length());
-                resource.getResourceMetadata().setResolutionPathInfo(rpi);
+                final String rpi = uri.substring(curPath.length());
+                // append html if no extension available
+                if ( rpi.indexOf('.') == -1 ) {
+                    rm.setResolutionPathInfo(rpi + ".html");
+                } else {
+                    rm.setResolutionPathInfo(rpi);
+                }
 
                 final String path = rm.getResolutionPath();
                 if (!uri.equals(path)) {
-                    resource.getResourceMetadata().setResolutionPath(uri);
+                    rm.setResolutionPath(uri);
                 }
 
                 return resource;