Author: drobiazko
Date: Thu Dec 31 12:50:08 2009
New Revision: 894834

URL: http://svn.apache.org/viewvc?rev=894834&view=rev
Log:
TAP5-963: Allow access to static resources (css, js, jpg, jpeg, png, gif) 
inside the app package

Added:
    
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/resources/nonaccessible.css
   (with props)
Modified:
    
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
    
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/app6/AssetProtectionDemo.tml
    
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/java/org/apache/tapestry5/integration/CutomAppPackageIntegrationTests.java
    
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/java/org/example/pages/AssetProtectionDemo.java
    
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/java/org/example/services/AppModule.java

Modified: 
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java?rev=894834&r1=894833&r2=894834&view=diff
==============================================================================
--- 
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
 (original)
+++ 
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
 Thu Dec 31 12:50:08 2009
@@ -2436,11 +2436,19 @@
     }
 
     public void contributeRegexAuthorizer(Configuration<String> regex,
+            
                 @Symbol("tapestry.scriptaculous.path") String scriptPath,
+                
                 @Symbol("tapestry.blackbird.path") String blackbirdPath,
+                
                 @Symbol("tapestry.datepicker.path") String datepickerPath,
+                
                 @Symbol(SymbolConstants.CONTEXT_ASSETS_AVAILABLE) boolean 
contextAvailable,
-                @Symbol(SymbolConstants.APPLICATION_VERSION) String appVersion)
+                
+                @Symbol(SymbolConstants.APPLICATION_VERSION) String appVersion,
+                
+                @Symbol(InternalConstants.TAPESTRY_APP_PACKAGE_PARAM) 
+                final String appPackageName)
 
     {
         //allow any js, jpg, jpeg, png, or css under org/apache/tapstry5. The 
funky bit of ([^/.]+/)* is what allows
@@ -2456,6 +2464,8 @@
         //allow access to virtual assets. Critical for tapestry-combined js 
files.
         regex.add("virtual/" + pathPattern);
 
+        regex.add("^" + appPackageName.replace(".", "/") + "/" + pathPattern);
+
         if (contextAvailable) 
         {
             //we allow everything underneath the context folder, as long as 
it's not

Modified: 
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/app6/AssetProtectionDemo.tml
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/app6/AssetProtectionDemo.tml?rev=894834&r1=894833&r2=894834&view=diff
==============================================================================
--- 
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/app6/AssetProtectionDemo.tml
 (original)
+++ 
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/app6/AssetProtectionDemo.tml
 Thu Dec 31 12:50:08 2009
@@ -1,5 +1,6 @@
 <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd";>
        <body>
-               <a href="${style}">Show CSS</a>
+               <p><a href="${style}">Show CSS</a></p>
+               <p><a href="${nonaccessible}">Non accessible</a></p>
        </body>
 </html>

Modified: 
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/java/org/apache/tapestry5/integration/CutomAppPackageIntegrationTests.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/java/org/apache/tapestry5/integration/CutomAppPackageIntegrationTests.java?rev=894834&r1=894833&r2=894834&view=diff
==============================================================================
--- 
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/java/org/apache/tapestry5/integration/CutomAppPackageIntegrationTests.java
 (original)
+++ 
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/java/org/apache/tapestry5/integration/CutomAppPackageIntegrationTests.java
 Thu Dec 31 12:50:08 2009
@@ -37,6 +37,10 @@
        start("Asset Protection Demo");
        clickAndWait("link=Show CSS");
        assertTextPresent("//Some CSS");
+       
+       start("Asset Protection Demo");
+       clickAndWait("link=Non accessible");
+       assertTextPresent("HTTP ERROR: 404");
     }
 
 }

Modified: 
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/java/org/example/pages/AssetProtectionDemo.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/java/org/example/pages/AssetProtectionDemo.java?rev=894834&r1=894833&r2=894834&view=diff
==============================================================================
--- 
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/java/org/example/pages/AssetProtectionDemo.java
 (original)
+++ 
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/java/org/example/pages/AssetProtectionDemo.java
 Thu Dec 31 12:50:08 2009
@@ -25,4 +25,9 @@
     @Path("style.css")
     @Property
     private Asset style;
+    
+    @Inject
+    @Path("classpath:nonaccessible.css")
+    @Property
+    private Asset nonaccessible;
 }

Modified: 
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/java/org/example/services/AppModule.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/java/org/example/services/AppModule.java?rev=894834&r1=894833&r2=894834&view=diff
==============================================================================
--- 
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/java/org/example/services/AppModule.java
 (original)
+++ 
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/java/org/example/services/AppModule.java
 Thu Dec 31 12:50:08 2009
@@ -14,21 +14,8 @@
 
 package org.example.services;
 
-import org.apache.tapestry5.internal.InternalConstants;
-import org.apache.tapestry5.ioc.Configuration;
-import org.apache.tapestry5.ioc.annotations.Symbol;
 
 public class AppModule
 {
 
-    public void contributeRegexAuthorizer(final Configuration<String> regex,
-            @Symbol(InternalConstants.TAPESTRY_APP_PACKAGE_PARAM) 
-            final String appPackageName) 
-    {
-
-        final String pattern = 
"([^/.]+/)*[^/.]+\\.((css)|(js)|(jpg)|(jpeg)|(png)|(gif))$";
-
-        regex.add("^" + appPackageName.replace(".", "/") + "/" + pattern);
-
-      }
 }

Added: 
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/resources/nonaccessible.css
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/resources/nonaccessible.css?rev=894834&view=auto
==============================================================================
--- 
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/resources/nonaccessible.css
 (added)
+++ 
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/resources/nonaccessible.css
 Thu Dec 31 12:50:08 2009
@@ -0,0 +1 @@
+//Bla
\ No newline at end of file

Propchange: 
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/resources/nonaccessible.css
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/resources/nonaccessible.css
------------------------------------------------------------------------------
    svn:mime-type = text/plain


Reply via email to