incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r702834 - /incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
Date Wed, 08 Oct 2008 12:28:25 GMT
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;



Mime
View raw message