Author: cziegeler
Date: Fri Apr 30 07:35:40 2010
New Revision: 939572
URL: http://svn.apache.org/viewvc?rev=939572&view=rev
Log:
Allow exact path matches
Modified:
sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java
sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/AbstractResourceCollector.java
sling/trunk/bundles/servlets/resolver/src/main/resources/OSGI-INF/metatype/metatype.properties
Modified:
sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java
URL:
http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java?rev=939572&r1=939571&r2=939572&view=diff
==============================================================================
---
sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java
(original)
+++
sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java
Fri Apr 30 07:35:40 2010
@@ -875,9 +875,6 @@ public class SlingServletResolver implem
if ( path == null || path.length() == 0 ||
path.equals("/") ) {
hasRoot = true;
}
- if ( !path.endsWith("/") ) {
- this.executionPaths[i] = path + '/';
- }
}
if ( hasRoot ) {
this.executionPaths = null;
Modified:
sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/AbstractResourceCollector.java
URL:
http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/AbstractResourceCollector.java?rev=939572&r1=939571&r2=939572&view=diff
==============================================================================
---
sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/AbstractResourceCollector.java
(original)
+++
sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/helper/AbstractResourceCollector.java
Fri Apr 30 07:35:40 2010
@@ -179,12 +179,19 @@ public abstract class AbstractResourceCo
return isPathAllowed(path, this.executionPaths);
}
+ /**
+ * This method checks whether a path is allowed to be executed.
+ */
public static boolean isPathAllowed(final String path, final String[]
executionPaths) {
if ( executionPaths == null ) {
return true;
}
- for(final String prefix : executionPaths ) {
- if ( path.startsWith(prefix) ) {
+ for(final String config : executionPaths ) {
+ if ( config.endsWith("/") ) {
+ if ( path.startsWith(config) ) {
+ return true;
+ }
+ } else if ( path.equals(config) ) {
return true;
}
}
Modified:
sling/trunk/bundles/servlets/resolver/src/main/resources/OSGI-INF/metatype/metatype.properties
URL:
http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/resolver/src/main/resources/OSGI-INF/metatype/metatype.properties?rev=939572&r1=939571&r2=939572&view=diff
==============================================================================
---
sling/trunk/bundles/servlets/resolver/src/main/resources/OSGI-INF/metatype/metatype.properties
(original)
+++
sling/trunk/bundles/servlets/resolver/src/main/resources/OSGI-INF/metatype/metatype.properties
Fri Apr 30 07:35:40 2010
@@ -64,4 +64,5 @@ servletresolver.useDefaultWorkspace.desc
servletresolver.paths.name = Execution Paths
servletresolver.paths.description = The paths to search for executable
scripts. If no path is configured \
this is treated like the default (/ = root) which allows to execute all
scripts. By configuring some \
- path prefixes the execution of scripts can be limited to some sub trees.
\ No newline at end of file
+ paths the execution of scripts can be limited. If a configured value ends
with a slash, the whole sub tree \
+ is allowed. Without a slash an exact matching script is allowed.
\ No newline at end of file