You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by dr...@apache.org on 2009/12/31 15:40:49 UTC
svn commit: r894852 - in /tapestry/tapestry5/trunk/tapestry-core/src:
main/java/org/apache/tapestry5/services/ test/app6/ test/app6/WEB-INF/
test/conf/ test/java/org/apache/tapestry5/integration/app6/
test/java/org/example/ test/java/org/example/pages/...
Author: drobiazko
Date: Thu Dec 31 14:40:49 2009
New Revision: 894852
URL: http://svn.apache.org/viewvc?rev=894852&view=rev
Log:
TAP5-963: Allow access to static resources (css, js, jpg, jpeg, png, gif) inside the app package
Added:
tapestry/tapestry5/trunk/tapestry-core/src/test/app6/
tapestry/tapestry5/trunk/tapestry-core/src/test/app6/AssetProtectionDemo.tml
tapestry/tapestry5/trunk/tapestry-core/src/test/app6/Index.tml
tapestry/tapestry5/trunk/tapestry-core/src/test/app6/WEB-INF/
tapestry/tapestry5/trunk/tapestry-core/src/test/app6/WEB-INF/web.xml (with props)
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app6/
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app6/CutomAppPackageIntegrationTests.java (with props)
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/example/
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/example/pages/
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/example/pages/AssetProtectionDemo.java (with props)
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/example/pages/Index.java (with props)
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/example/services/
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/example/services/AppModule.java (with props)
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/nonaccessible.css (with props)
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/example/
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/example/pages/
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/example/pages/style.css (with props)
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
tapestry/tapestry5/trunk/tapestry-core/src/test/conf/testng.xml
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java?rev=894852&r1=894851&r2=894852&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java Thu Dec 31 14:40:49 2009
@@ -2861,12 +2861,24 @@
}
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("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(InternalConstants.TAPESTRY_APP_PACKAGE_PARAM)
+ String appPackageName)
{
// allow any js, jpg, jpeg, png, or css under org/apache/tapestry5,
// along with
@@ -2885,6 +2897,8 @@
// allow access to virtual assets. Critical for tapestry-combined js
// files.
regex.add("virtual/" + pathPattern);
+
+ regex.add("^" + appPackageName.replace(".", "/") + "/" + pathPattern);
if (contextAvailable)
{
Added: tapestry/tapestry5/trunk/tapestry-core/src/test/app6/AssetProtectionDemo.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app6/AssetProtectionDemo.tml?rev=894852&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/app6/AssetProtectionDemo.tml (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/app6/AssetProtectionDemo.tml Thu Dec 31 14:40:49 2009
@@ -0,0 +1,6 @@
+<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
+ <body>
+ <p><a href="${style}">Show CSS</a></p>
+ <p><a href="${nonaccessible}">Non accessible</a></p>
+ </body>
+</html>
Added: tapestry/tapestry5/trunk/tapestry-core/src/test/app6/Index.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app6/Index.tml?rev=894852&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/app6/Index.tml (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/app6/Index.tml Thu Dec 31 14:40:49 2009
@@ -0,0 +1,11 @@
+<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
+ <head>
+ <title>Index</title>
+ </head>
+ <body>
+ <h1>Index</h1>
+ <p>
+ <t:pagelink page="assetprotectiondemo">Asset Protection Demo</t:pagelink>
+ </p>
+ </body>
+</html>
\ No newline at end of file
Added: tapestry/tapestry5/trunk/tapestry-core/src/test/app6/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app6/WEB-INF/web.xml?rev=894852&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/app6/WEB-INF/web.xml (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/app6/WEB-INF/web.xml Thu Dec 31 14:40:49 2009
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2009 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!DOCTYPE web-app
+ PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+ <display-name>Integration Test App 6</display-name>
+ <context-param>
+ <param-name>tapestry.app-package</param-name>
+ <param-value>org.example</param-value>
+ </context-param>
+ <filter>
+ <filter-name>app</filter-name>
+ <filter-class>org.apache.tapestry5.TapestryFilter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>app</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+</web-app>
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/app6/WEB-INF/web.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/app6/WEB-INF/web.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/conf/testng.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/conf/testng.xml?rev=894852&r1=894851&r2=894852&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/conf/testng.xml (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/conf/testng.xml Thu Dec 31 14:40:49 2009
@@ -80,6 +80,17 @@
<class name="org.apache.tapestry5.test.SeleniumLauncher"/>
</classes>
</test>
+
+ <test name="Custom App Package Tests" enabled="true">
+ <parameter name="tapestry.web-app-folder" value="src/test/app6"/>
+ <packages>
+ <package name="org.apache.tapestry5.integration.app6"/>
+ </packages>
+ <classes>
+ <class name="org.apache.tapestry5.test.SeleniumLauncher"/>
+ </classes>
+ </test>
+
<test name="Live Reload Tests" enabled="true">
<packages>
<package name="org.apache.tapestry5.integration.reload"/>
Added: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app6/CutomAppPackageIntegrationTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app6/CutomAppPackageIntegrationTests.java?rev=894852&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app6/CutomAppPackageIntegrationTests.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app6/CutomAppPackageIntegrationTests.java Thu Dec 31 14:40:49 2009
@@ -0,0 +1,40 @@
+// Copyright 2009 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry5.integration.app6;
+
+import org.apache.tapestry5.integration.TapestryCoreTestCase;
+import org.testng.annotations.Test;
+
+/**
+ * Additional integration tests that do not fit with the main group due to the need for special configuration.
+ */
+public class CutomAppPackageIntegrationTests extends TapestryCoreTestCase
+{
+
+
+ /** TAP5-815 */
+ @Test
+ public void asset_protection()
+ {
+ clickThru("Asset Protection Demo");
+ clickAndWait("link=Show CSS");
+ assertTextPresent("//Some CSS");
+
+ clickThru("Asset Protection Demo");
+ clickAndWait("link=Non accessible");
+ assertTextPresent("HTTP ERROR 404");
+ }
+
+}
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app6/CutomAppPackageIntegrationTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app6/CutomAppPackageIntegrationTests.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/example/pages/AssetProtectionDemo.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/example/pages/AssetProtectionDemo.java?rev=894852&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/example/pages/AssetProtectionDemo.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/example/pages/AssetProtectionDemo.java Thu Dec 31 14:40:49 2009
@@ -0,0 +1,33 @@
+// Copyright 2009 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.example.pages;
+
+import org.apache.tapestry5.Asset;
+import org.apache.tapestry5.annotations.Path;
+import org.apache.tapestry5.annotations.Property;
+import org.apache.tapestry5.ioc.annotations.Inject;
+
+public class AssetProtectionDemo
+{
+ @Inject
+ @Path("style.css")
+ @Property
+ private Asset style;
+
+ @Inject
+ @Path("classpath:nonaccessible.css")
+ @Property
+ private Asset nonaccessible;
+}
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/example/pages/AssetProtectionDemo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/example/pages/AssetProtectionDemo.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/example/pages/Index.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/example/pages/Index.java?rev=894852&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/example/pages/Index.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/example/pages/Index.java Thu Dec 31 14:40:49 2009
@@ -0,0 +1,21 @@
+// Copyright 2009 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.example.pages;
+
+
+public class Index
+{
+
+}
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/example/pages/Index.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/example/pages/Index.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/example/services/AppModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/example/services/AppModule.java?rev=894852&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/example/services/AppModule.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/example/services/AppModule.java Thu Dec 31 14:40:49 2009
@@ -0,0 +1,21 @@
+// Copyright 2009 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.example.services;
+
+
+public class AppModule
+{
+
+}
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/example/services/AppModule.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/example/services/AppModule.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: tapestry/tapestry5/trunk/tapestry-core/src/test/resources/nonaccessible.css
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/resources/nonaccessible.css?rev=894852&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/resources/nonaccessible.css (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/resources/nonaccessible.css Thu Dec 31 14:40:49 2009
@@ -0,0 +1 @@
+//Bla
\ No newline at end of file
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/resources/nonaccessible.css
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/resources/nonaccessible.css
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/example/pages/style.css
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/example/pages/style.css?rev=894852&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/example/pages/style.css (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/example/pages/style.css Thu Dec 31 14:40:49 2009
@@ -0,0 +1 @@
+//Some CSS
\ No newline at end of file
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/example/pages/style.css
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/example/pages/style.css
------------------------------------------------------------------------------
svn:mime-type = text/plain