Author: pete
Date: Thu Apr 28 17:53:37 2011
New Revision: 1097564

URL: http://svn.apache.org/viewvc?rev=1097564&view=rev
Log:
WICKET-3650: parentFolderPlaceholder has inconsistent javadoc and is not 
disabled when set to null

Modified:
    
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/SharedResources.java
    
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/settings/IResourceSettings.java

Modified: 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/SharedResources.java
URL: 
http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/SharedResources.java?rev=1097564&r1=1097563&r2=1097564&view=diff
==============================================================================
--- 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/SharedResources.java
 (original)
+++ 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/SharedResources.java
 Thu Apr 28 17:53:37 2011
@@ -67,15 +67,17 @@ public class SharedResources
        public static String resourceKey(final String path, final Locale 
locale, final String style)
        {
                // escape sequence for '..' (prevents crippled urls in browser)
-               final CharSequence parentEscape = Application.get()
+               final CharSequence parentEscapeSequence = Application.get()
                        .getResourceSettings()
                        .getParentFolderPlaceholder();
 
                final String extension = Files.extension(path);
                String basePath = Files.basePath(path, extension);
 
-               if (Strings.isEmpty(parentEscape) &&
-                       (Application.get().getConfigurationType() == 
Application.DEVELOPMENT) &&
+               boolean parentEscape = Strings.isEmpty(parentEscapeSequence) == 
false;
+               
+               if (parentEscape == false &&
+                       
(Application.DEVELOPMENT.equals(Application.get().getConfigurationType())) &&
                        basePath.contains("../"))
                {
                        
log.error("----------------------------------------------------------------------------------------");
@@ -84,9 +86,13 @@ public class SharedResources
                        
log.error("IResourceSettings.getParentFolderPlaceholder() and 
PackageResourceGuard for more details");
                        
log.error("----------------------------------------------------------------------------------------");
                }
+               // replace parent folder sequence with escape sequence (if 
feature is enabled)
+               if (parentEscape)
+               {
+                       // get relative path to resource, replace '..' with 
escape sequence
+                       basePath = basePath.replace("../", parentEscapeSequence 
+ "/");
+               }
 
-               // get relative path to resource, replace '..' with escape 
sequence
-               basePath = basePath.replace("../", parentEscape + "/");
                final AppendingStringBuffer buffer = new 
AppendingStringBuffer(basePath.length() + 16);
                buffer.append(basePath);
 

Modified: 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/settings/IResourceSettings.java
URL: 
http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/settings/IResourceSettings.java?rev=1097564&r1=1097563&r2=1097564&view=diff
==============================================================================
--- 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/settings/IResourceSettings.java
 (original)
+++ 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/settings/IResourceSettings.java
 Thu Apr 28 17:53:37 2011
@@ -357,13 +357,14 @@ public interface IResourceSettings
 
        /**
         * Placeholder string for '..' within resource urls (which will be 
crippled by the browser and
-        * not work anymore). Note that by default the placeholder string is 
empty '' and thus will not
+        * not work anymore). Note that by default the placeholder string is 
<code>null</code> and thus will not
         * allow to access parent folders. That is by purpose and for security 
reasons (see
         * Wicket-1992). In case you really need it, a good value for 
placeholder would e.g. be "$up$".
         * Resources additionally are protected by a
         * {@link org.apache.wicket.markup.html.IPackageResourceGuard 
IPackageResourceGuard}
-        * implementation such as {@link 
org.apache.wicket.resource.resourceGuard.PackageResourceGuard
-        * PackageResourceGuard} which you may use or extend based on your 
needs.
+        * implementation such as 
+        * {@link org.apache.wicket.markup.html.PackageResourceGuard 
PackageResourceGuard}
+        * which you may use or extend based on your needs.
         * 
         * @return placeholder
         */
@@ -371,13 +372,14 @@ public interface IResourceSettings
 
        /**
         * Placeholder string for '..' within resource urls (which will be 
crippled by the browser and
-        * not work anymore). Note that by default the placeholder string is 
empty '' and thus will not
+        * not work anymore). Note that by default the placeholder string is 
<code>null</code> and thus will not
         * allow to access parent folders. That is by purpose and for security 
reasons (see
         * Wicket-1992). In case you really need it, a good value for 
placeholder would e.g. be "$up$".
         * Resources additionally are protected by a
         * {@link org.apache.wicket.markup.html.IPackageResourceGuard 
IPackageResourceGuard}
-        * implementation such as {@link 
org.apache.wicket.resource.resourceGuard.PackageResourceGuard
-        * PackageResourceGuard} which you may use or extend based on your 
needs.
+        * implementation such as 
+        * {@link org.apache.wicket.markup.html.PackageResourceGuard 
PackageResourceGuard}
+        * which you may use or extend based on your needs.
         * 
         * @see #getParentFolderPlaceholder()
         * 


Reply via email to