[jira] [Commented] (TAP5-2070) Respond with a HTTP 404 if the page is activated with an activation context not explicitly supported by the page itself
[ https://issues.apache.org/jira/browse/TAP5-2070?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13728527#comment-13728527 ] Hudson commented on TAP5-2070: -- FAILURE: Integrated in tapestry-trunk-freestyle #1123 (See [https://builds.apache.org/job/tapestry-trunk-freestyle/1123/]) TAP5-2070 annotation and service response handler to get access to page with exact activation context (mlusetti: rev 8fecc8e18e46919387dae2683ebc231f6beb1a74) * tapestry-core/src/main/java/org/apache/tapestry5/annotations/UnknownActivationContextCheck.java * tapestry-core/src/main/java/org/apache/tapestry5/internal/services/UnknownActivationContextHandler.java * tapestry-core/src/main/java/org/apache/tapestry5/internal/services/meta/UnknownActivationContextExtractor.java * tapestry-core/src/main/java/org/apache/tapestry5/internal/services/UnknownActivationContextHandlerImpl.java TAP5-2070 have the component model be able to declare if it handle the activation context (mlusetti: rev 5cc984b2c826e619d1dcdb52704bdffca263a97e) * tapestry-core/src/main/java/org/apache/tapestry5/internal/model/MutableComponentModelImpl.java TAP5-2070 declare if the component handle the activation context (mlusetti: rev 8640a40fdd25f23bd071fcb627ab31cac8670ca7) * tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/OnEventWorker.java TAP5-2070 publish new method to let other code check for activation context handling (mlusetti: rev 3054fd6ee8ec8c3e8936838c5512780c84ea8598) * 54_RELEASE_NOTES.txt * tapestry-core/src/main/java/org/apache/tapestry5/model/MutableComponentModel.java * tapestry-core/src/main/java/org/apache/tapestry5/model/ComponentModel.java TAP5-2070 have the meta data constants used to check each page's value (mlusetti: rev 2db059c086ca5999889c3b06f4852cf491e5f78b) * tapestry-core/src/main/java/org/apache/tapestry5/MetaDataConstants.java TAP5-2070 hook the services into our IoC (mlusetti: rev 6d70228460b0229aa106da356e98ba31ca0ecb36) * tapestry-core/src/main/java/org/apache/tapestry5/modules/TapestryModule.java * tapestry-core/src/main/java/org/apache/tapestry5/modules/InternalModule.java TAP5-2070 check each page for UnknownActivationContext annotation (mlusetti: rev d1fabecccf7bd81d0dae8eefda055cf02ee4f981) * tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DefaultRequestExceptionHandler.java * tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentEventImpl.java * tapestry-core/src/main/java/org/apache/tapestry5/internal/pageload/PageLoaderImpl.java * tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PageActivatorImpl.java * tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/ComponentPageElementImpl.java * tapestry-core/src/main/java/org/apache/tapestry5/internal/pageload/ComponentAssemblerImpl.java TAP5-2070 test case to be expanded to use something different then Selenium since it doesn't check http status code (mlusetti: rev 6762367c1f0369814089f3c0babdc93f71238094) * tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ComponentEventImplTest.java * tapestry-core/src/test/java/org/apache/tapestry5/internal/structure/ComponentPageElementImplTest.java * tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java TAP5-2070 actual test pages (mlusetti: rev c13ed06021cf280ba43b7cd6053ca88da8230b55) * tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/UnknownActivationContextDemo.java * tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/UnknownActivationContextTests.groovy * tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/UnknownActivationContextDemo.tml > Respond with a HTTP 404 if the page is activated with an activation context > not explicitly supported by the page itself > --- > > Key: TAP5-2070 > URL: https://issues.apache.org/jira/browse/TAP5-2070 > Project: Tapestry 5 > Issue Type: Improvement > Components: tapestry-core >Affects Versions: 5.4 >Reporter: Massimo Lusetti >Assignee: Massimo Lusetti > > The behavior from day one for pages within Tapestry is to being able to serve > requests that come with an activation context with more parameters that the > ones declared by the page itself. > This feature lead the framework to serve requests that comes to URL which are > not explicitly declared by the pages, for example a page named: Super with an > activation event handler method like this one: > onActivate(String character) { ... } > will finely serve requests for: > /super/mario > /super/luigi > /super/wario > /super/waluigi > but it will also serve requests for: > /super/mario/luigi/wario/waluigi > This issue
[01/10] git commit: clean a leftover
Updated Branches: refs/heads/master 4489a8a4b -> c13ed0602 clean a leftover Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/84d26fd5 Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/84d26fd5 Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/84d26fd5 Branch: refs/heads/master Commit: 84d26fd52167a7d9b4ecda66a5864d4f807d1b78 Parents: 4489a8a Author: Massimo Lusetti Authored: Fri Aug 2 11:51:21 2013 +0200 Committer: Massimo Lusetti Committed: Fri Aug 2 11:51:21 2013 +0200 -- .../archetype-resources/src/main/resources/pages/Index.tml | 2 -- 1 file changed, 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/84d26fd5/quickstart/filtered/archetype-resources/src/main/resources/pages/Index.tml -- diff --git a/quickstart/filtered/archetype-resources/src/main/resources/pages/Index.tml b/quickstart/filtered/archetype-resources/src/main/resources/pages/Index.tml index 6bc607b..fa4a504 100644 --- a/quickstart/filtered/archetype-resources/src/main/resources/pages/Index.tml +++ b/quickstart/filtered/archetype-resources/src/main/resources/pages/Index.tml @@ -21,8 +21,6 @@ Learn more ยป - -
[10/10] git commit: TAP5-2070 actual test pages
TAP5-2070 actual test pages Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/c13ed060 Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/c13ed060 Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/c13ed060 Branch: refs/heads/master Commit: c13ed06021cf280ba43b7cd6053ca88da8230b55 Parents: 6762367 Author: Massimo Lusetti Authored: Sat Aug 3 14:07:48 2013 +0200 Committer: Massimo Lusetti Committed: Sat Aug 3 14:07:48 2013 +0200 -- .../app1/UnknownActivationContextTests.groovy | 13 +++ .../pages/UnknownActivationContextDemo.java | 24 .../app1/pages/UnknownActivationContextDemo.tml | 10 3 files changed, 47 insertions(+) -- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/c13ed060/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/UnknownActivationContextTests.groovy -- diff --git a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/UnknownActivationContextTests.groovy b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/UnknownActivationContextTests.groovy new file mode 100644 index 000..5a2fd3d --- /dev/null +++ b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/UnknownActivationContextTests.groovy @@ -0,0 +1,13 @@ +package org.apache.tapestry5.integration.app1 + +import org.apache.tapestry5.test.SeleniumTestCase +import org.testng.annotations.Test + +class UnknownActivationContextTests extends SeleniumTestCase +{ +// @Test +void http_status_code_test_for_unknown_activation_context_case() +{ +// TODO Use a workaround Selenium limitation to check http status code +} +} http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/c13ed060/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/UnknownActivationContextDemo.java -- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/UnknownActivationContextDemo.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/UnknownActivationContextDemo.java new file mode 100644 index 000..368f159 --- /dev/null +++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/UnknownActivationContextDemo.java @@ -0,0 +1,24 @@ +// Copyright 2008 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.app1.pages; + +import org.apache.tapestry5.annotations.UnknownActivationContextCheck; + +@UnknownActivationContextCheck +public class UnknownActivationContextDemo +{ + +} http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/c13ed060/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/UnknownActivationContextDemo.tml -- diff --git a/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/UnknownActivationContextDemo.tml b/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/UnknownActivationContextDemo.tml new file mode 100644 index 000..a168227 --- /dev/null +++ b/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/UnknownActivationContextDemo.tml @@ -0,0 +1,10 @@ +http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";> + +Page called with an unknown activation context + + +You should never see me if use an activation context + + + \ No newline at end of file
[02/10] git commit: TAP5-2070 annotation and service response handler to get access to page with exact activation context
TAP5-2070 annotation and service response handler to get access to page with exact activation context Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/8fecc8e1 Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/8fecc8e1 Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/8fecc8e1 Branch: refs/heads/master Commit: 8fecc8e18e46919387dae2683ebc231f6beb1a74 Parents: 84d26fd Author: Massimo Lusetti Authored: Sat Aug 3 13:52:30 2013 +0200 Committer: Massimo Lusetti Committed: Sat Aug 3 13:52:30 2013 +0200 -- .../UnknownActivationContextCheck.java | 48 + .../UnknownActivationContextHandler.java| 41 ++ .../UnknownActivationContextHandlerImpl.java| 57 .../meta/UnknownActivationContextExtractor.java | 29 ++ 4 files changed, 175 insertions(+) -- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/8fecc8e1/tapestry-core/src/main/java/org/apache/tapestry5/annotations/UnknownActivationContextCheck.java -- diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/annotations/UnknownActivationContextCheck.java b/tapestry-core/src/main/java/org/apache/tapestry5/annotations/UnknownActivationContextCheck.java new file mode 100644 index 000..7752693 --- /dev/null +++ b/tapestry-core/src/main/java/org/apache/tapestry5/annotations/UnknownActivationContextCheck.java @@ -0,0 +1,48 @@ +// Copyright 2008, 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.annotations; + +import org.apache.tapestry5.ioc.annotations.AnnotationUseContext; +import org.apache.tapestry5.ioc.annotations.UseWith; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * A marker annotation that indicates that the page in question may only be accessed with a exact actvation context. + * + * @see org.apache.tapestry5.MetaDataConstants#UNKNOWN_ACTIVATION_CONTEXT_CHECK + * @since 5.4 + */ +@Target(TYPE) +@Retention(RUNTIME) +@Documented +@UseWith(AnnotationUseContext.PAGE) +public @interface UnknownActivationContextCheck +{ + /** +* If true, the default, the framework will check for an exact (number and type of parameters) +* activation context method and if not found will respond with a 404 Not Found status code, if false +* the activation context is ignored as it was before 5.4 release. +* +* @see org.apache.tapestry5.MetaDataConstants#UNKNOWN_ACTIVATION_CONTEXT_CHECK +* @see org.apache.tapestry5.services.HttpError +*/ + boolean value() default true; +} http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/8fecc8e1/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/UnknownActivationContextHandler.java -- diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/UnknownActivationContextHandler.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/UnknownActivationContextHandler.java new file mode 100644 index 000..1bc0d5b --- /dev/null +++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/UnknownActivationContextHandler.java @@ -0,0 +1,41 @@ +// Copyright 2030 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.internal.services; + +import org.apache.tapestry5.ComponentResources; +import org.apache.tapestry
[03/10] git commit: TAP5-2070 have the component model be able to declare if it handle the activation context
TAP5-2070 have the component model be able to declare if it handle the activation context Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/5cc984b2 Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/5cc984b2 Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/5cc984b2 Branch: refs/heads/master Commit: 5cc984b2c826e619d1dcdb52704bdffca263a97e Parents: 8fecc8e Author: Massimo Lusetti Authored: Sat Aug 3 13:54:24 2013 +0200 Committer: Massimo Lusetti Committed: Sat Aug 3 13:54:24 2013 +0200 -- .../internal/model/MutableComponentModelImpl.java| 15 +++ 1 file changed, 15 insertions(+) -- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/5cc984b2/tapestry-core/src/main/java/org/apache/tapestry5/internal/model/MutableComponentModelImpl.java -- diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/model/MutableComponentModelImpl.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/model/MutableComponentModelImpl.java index 12691f4..a78366d 100644 --- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/model/MutableComponentModelImpl.java +++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/model/MutableComponentModelImpl.java @@ -69,6 +69,8 @@ public final class MutableComponentModelImpl implements MutableComponentModel private final String libraryName; + private boolean handleActivationEventContext; + public MutableComponentModelImpl(String componentClassName, Logger logger, Resource baseResource, ComponentModel parentModel, boolean pageClass, String libraryName) { @@ -79,6 +81,9 @@ public final class MutableComponentModelImpl implements MutableComponentModel this.pageClass = pageClass; this.libraryName = libraryName; + // Default to false, explicitly set during page transformation + this.handleActivationEventContext = false; + // Pre-allocate names from the parent, to avoid name collisions. if (this.parentModel != null) @@ -394,4 +399,14 @@ public final class MutableComponentModelImpl implements MutableComponentModel { return pageClass; } + + public void doHandleActivationEventContext() + { + this.handleActivationEventContext = true; + } + + public boolean handleActivationEventContext() + { + return this.handleActivationEventContext; + } }
[07/10] git commit: TAP5-2070 hook the services into our IoC
TAP5-2070 hook the services into our IoC Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/6d702284 Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/6d702284 Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/6d702284 Branch: refs/heads/master Commit: 6d70228460b0229aa106da356e98ba31ca0ecb36 Parents: 2db059c Author: Massimo Lusetti Authored: Sat Aug 3 14:04:45 2013 +0200 Committer: Massimo Lusetti Committed: Sat Aug 3 14:04:45 2013 +0200 -- .../main/java/org/apache/tapestry5/modules/InternalModule.java | 1 + .../main/java/org/apache/tapestry5/modules/TapestryModule.java | 6 ++ 2 files changed, 7 insertions(+) -- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/6d702284/tapestry-core/src/main/java/org/apache/tapestry5/modules/InternalModule.java -- diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/modules/InternalModule.java b/tapestry-core/src/main/java/org/apache/tapestry5/modules/InternalModule.java index b78a4ff..f5e190b 100644 --- a/tapestry-core/src/main/java/org/apache/tapestry5/modules/InternalModule.java +++ b/tapestry-core/src/main/java/org/apache/tapestry5/modules/InternalModule.java @@ -69,6 +69,7 @@ public class InternalModule binder.bind(InternalComponentInvalidationEventHub.class); binder.bind(PageSource.class, PageSourceImpl.class); binder.bind(PageLoader.class, PageLoaderImpl.class).preventReloading(); + binder.bind(UnknownActivationContextHandler.class, UnknownActivationContextHandlerImpl.class); } public static CookieSource buildCookieSource(final RequestGlobals requestGlobals) http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/6d702284/tapestry-core/src/main/java/org/apache/tapestry5/modules/TapestryModule.java -- diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/modules/TapestryModule.java b/tapestry-core/src/main/java/org/apache/tapestry5/modules/TapestryModule.java index 1620d02..17ddbeb 100644 --- a/tapestry-core/src/main/java/org/apache/tapestry5/modules/TapestryModule.java +++ b/tapestry-core/src/main/java/org/apache/tapestry5/modules/TapestryModule.java @@ -45,6 +45,7 @@ import org.apache.tapestry5.internal.services.messages.PropertiesFileParserImpl; import org.apache.tapestry5.internal.services.meta.ContentTypeExtractor; import org.apache.tapestry5.internal.services.meta.MetaAnnotationExtractor; import org.apache.tapestry5.internal.services.meta.MetaWorkerImpl; +import org.apache.tapestry5.internal.services.meta.UnknownActivationContextExtractor; import org.apache.tapestry5.internal.services.security.ClientWhitelistImpl; import org.apache.tapestry5.internal.services.security.LocalhostOnly; import org.apache.tapestry5.internal.services.templates.DefaultTemplateLocator; @@ -2084,6 +2085,10 @@ public final class TapestryModule configuration.add(SymbolConstants.BOOTSTRAP_ROOT, "${tapestry.asset.root}/bootstrap_2_3_2"); configuration.add(SymbolConstants.SESSION_LOCKING_ENABLED, true); + + // TAP5-2070 keep the old behavior, defaults to false + configuration.add(MetaDataConstants.UNKNOWN_ACTIVATION_CONTEXT_CHECK, false); + } /** @@ -2464,6 +2469,7 @@ public final class TapestryModule configuration.add(Secure.class, new FixedExtractor(MetaDataConstants.SECURE_PAGE)); configuration.addInstance(ContentType.class, ContentTypeExtractor.class); configuration.add(WhitelistAccessOnly.class, new FixedExtractor(MetaDataConstants.WHITELIST_ONLY_PAGE)); + configuration.addInstance(UnknownActivationContextCheck.class, UnknownActivationContextExtractor.class); } /**
[05/10] git commit: TAP5-2070 publish new method to let other code check for activation context handling
TAP5-2070 publish new method to let other code check for activation context handling Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/3054fd6e Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/3054fd6e Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/3054fd6e Branch: refs/heads/master Commit: 3054fd6ee8ec8c3e8936838c5512780c84ea8598 Parents: 8640a40 Author: Massimo Lusetti Authored: Sat Aug 3 14:03:16 2013 +0200 Committer: Massimo Lusetti Committed: Sat Aug 3 14:03:16 2013 +0200 -- 54_RELEASE_NOTES.txt | 5 + .../org/apache/tapestry5/model/ComponentModel.java | 11 +++ .../apache/tapestry5/model/MutableComponentModel.java | 13 + 3 files changed, 29 insertions(+) -- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3054fd6e/54_RELEASE_NOTES.txt -- diff --git a/54_RELEASE_NOTES.txt b/54_RELEASE_NOTES.txt index 6255469..fe4298c 100644 --- a/54_RELEASE_NOTES.txt +++ b/54_RELEASE_NOTES.txt @@ -257,6 +257,11 @@ It has been moved to package org.apache.tapestry5; this represents a minor incom StreamableResource has been modified, adding a new `getChecksum()` method; this interface is rarely, if ever, used or implemented by application code. +## MutableComponentModel Extended + +MutableComponentModel has been modified, adding a new ` doHandleActivationEventContext()' method to help check +activation context exactness; this interface is rarely, if ever, used or implemented by application code + ## Module classes moved to new modules Traditionally, Tapestry IoC Module classes have lived in the same package as the service interfaces they define, and http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3054fd6e/tapestry-core/src/main/java/org/apache/tapestry5/model/ComponentModel.java -- diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/model/ComponentModel.java b/tapestry-core/src/main/java/org/apache/tapestry5/model/ComponentModel.java index 04d5d3d..f19c018 100644 --- a/tapestry-core/src/main/java/org/apache/tapestry5/model/ComponentModel.java +++ b/tapestry-core/src/main/java/org/apache/tapestry5/model/ComponentModel.java @@ -211,4 +211,15 @@ public interface ComponentModel * @since 5.2.0 */ String[] getOrderForMixin(String mixinClassName); + + /** +* Relevant for pages only, indicates that the component handle the {@link org.apache.tapestry5.EventConstants.ACTIVATE} +* events with a catch all rules +* +* @since 5.4 +* @see {@link MutableComponentModel.doHandleActivationEventContext()} +* @return true in case the page implement a catch all rules for the activate event context, +* false otherwise +*/ + boolean handleActivationEventContext(); } http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3054fd6e/tapestry-core/src/main/java/org/apache/tapestry5/model/MutableComponentModel.java -- diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/model/MutableComponentModel.java b/tapestry-core/src/main/java/org/apache/tapestry5/model/MutableComponentModel.java index 227eec9..c7f0477 100644 --- a/tapestry-core/src/main/java/org/apache/tapestry5/model/MutableComponentModel.java +++ b/tapestry-core/src/main/java/org/apache/tapestry5/model/MutableComponentModel.java @@ -120,4 +120,17 @@ public interface MutableComponentModel extends ComponentModel * @since 5.1.0.0 */ void addEventHandler(String eventType); + + /** +* Relevant for pages only, identifies that the component handle {@link org.apache.tapestry5.EventConstants.ACTIVATE} +* events supporting one of the three special case for catch all rules: +* +* {@link java.lang.Object}[] +* {@link java.util.List} +* {@link org.apache.tapestry5.EventContext} +* +* +* @since 5.4 +*/ + void doHandleActivationEventContext(); }
[04/10] git commit: TAP5-2070 declare if the component handle the activation context
TAP5-2070 declare if the component handle the activation context Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/8640a40f Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/8640a40f Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/8640a40f Branch: refs/heads/master Commit: 8640a40fdd25f23bd071fcb627ab31cac8670ca7 Parents: 5cc984b Author: Massimo Lusetti Authored: Sat Aug 3 13:55:47 2013 +0200 Committer: Massimo Lusetti Committed: Sat Aug 3 13:55:47 2013 +0200 -- .../org/apache/tapestry5/internal/transform/OnEventWorker.java | 6 ++ 1 file changed, 6 insertions(+) -- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/8640a40f/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/OnEventWorker.java -- diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/OnEventWorker.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/OnEventWorker.java index 234f7db..06f3a1d 100644 --- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/OnEventWorker.java +++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/OnEventWorker.java @@ -132,6 +132,8 @@ public class OnEventWorker implements ComponentClassTransformWorker2 int minContextValues = 0; + boolean handleActivationEventContext = false; + EventHandlerMethod(PlasticMethod method) { this.method = method; @@ -220,6 +222,7 @@ public class OnEventWorker implements ComponentClassTransformWorker2 if (provider != null) { providers.add(provider); + this.handleActivationEventContext = true; continue; } @@ -382,6 +385,9 @@ public class OnEventWorker implements ComponentClassTransformWorker2 method.buildMatchAndInvocation(builder, resultVariable); model.addEventHandler(method.eventType); + + if (method.handleActivationEventContext) + model.doHandleActivationEventContext(); } builder.loadVariable(resultVariable).returnResult();
[06/10] git commit: TAP5-2070 have the meta data constants used to check each page's value
TAP5-2070 have the meta data constants used to check each page's value Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/2db059c0 Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/2db059c0 Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/2db059c0 Branch: refs/heads/master Commit: 2db059c086ca5999889c3b06f4852cf491e5f78b Parents: 3054fd6 Author: Massimo Lusetti Authored: Sat Aug 3 14:04:01 2013 +0200 Committer: Massimo Lusetti Committed: Sat Aug 3 14:04:01 2013 +0200 -- .../src/main/java/org/apache/tapestry5/MetaDataConstants.java | 7 +++ 1 file changed, 7 insertions(+) -- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/2db059c0/tapestry-core/src/main/java/org/apache/tapestry5/MetaDataConstants.java -- diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/MetaDataConstants.java b/tapestry-core/src/main/java/org/apache/tapestry5/MetaDataConstants.java index c4baddb..be9a2f9 100644 --- a/tapestry-core/src/main/java/org/apache/tapestry5/MetaDataConstants.java +++ b/tapestry-core/src/main/java/org/apache/tapestry5/MetaDataConstants.java @@ -43,4 +43,11 @@ public class MetaDataConstants * @since 5.3 */ public static final String WHITELIST_ONLY_PAGE = "tapestry.white-list-only-page"; + + /** +* Meta data key applied to pages that may only be accessed with a exact activation context. +* +* @since 5.4 +*/ + public static final String UNKNOWN_ACTIVATION_CONTEXT_CHECK = "tapestry.unknwon-activation-context-check"; }
[09/10] git commit: TAP5-2070 test case to be expanded to use something different then Selenium since it doesn't check http status code
TAP5-2070 test case to be expanded to use something different then Selenium since it doesn't check http status code Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/6762367c Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/6762367c Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/6762367c Branch: refs/heads/master Commit: 6762367c1f0369814089f3c0babdc93f71238094 Parents: d1fabec Author: Massimo Lusetti Authored: Sat Aug 3 14:07:01 2013 +0200 Committer: Massimo Lusetti Committed: Sat Aug 3 14:07:01 2013 +0200 -- .../tapestry5/integration/app1/pages/Index.java | 4 +++- .../services/ComponentEventImplTest.java| 24 ++-- .../structure/ComponentPageElementImplTest.java | 10 3 files changed, 21 insertions(+), 17 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/6762367c/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java -- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java index 2142991..866ced7 100644 --- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java +++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java @@ -518,7 +518,9 @@ public class Index new Item("OverrideLabelClassDemo", "Override Label Class Demo", "Setting class attribute on Label component"), -new Item("FormLinkParameters", "FormLinkParameters Demo", "Form link parameters should be unescaped for a hidden field") +new Item("FormLinkParameters", "FormLinkParameters Demo", "Form link parameters should be unescaped for a hidden field"), + + new Item("UnknownAtcivationContext", "Unknown Activation Context Demo", "Page refuse to serve if called with an unknown activation context") ); static http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/6762367c/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ComponentEventImplTest.java -- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ComponentEventImplTest.java b/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ComponentEventImplTest.java index 0d9d508..9eb353b 100644 --- a/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ComponentEventImplTest.java +++ b/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ComponentEventImplTest.java @@ -62,7 +62,7 @@ public class ComponentEventImplTest extends InternalBaseTestCase replay(); -ComponentEvent event = new ComponentEventImpl("eventType", "someId", context, handler, null, logger); +ComponentEvent event = new ComponentEventImpl("eventType", "someId", context, handler, null, false, mockComponentModel(), logger); assertTrue(event.matches("eventType", "someId", 0)); assertFalse(event.matches("foo", "someId", 0)); @@ -88,7 +88,7 @@ public class ComponentEventImplTest extends InternalBaseTestCase replay(); -ComponentEvent event = new ComponentEventImpl("eventType", "someId", context, handler, resources, logger); +ComponentEvent event = new ComponentEventImpl("eventType", "someId", context, handler, resources, false, mockComponentModel(), logger); event.storeResult(result); @@ -111,7 +111,7 @@ public class ComponentEventImplTest extends InternalBaseTestCase replay(); -ComponentEvent event = new ComponentEventImpl("eventType", "someId", context, handler, null, logger); +ComponentEvent event = new ComponentEventImpl("eventType", "someId", context, handler, null, false, mockComponentModel(), logger); assertTrue(event.matches("EVENTTYPE", "someid", 0)); @@ -131,7 +131,7 @@ public class ComponentEventImplTest extends InternalBaseTestCase replay(); -ComponentEvent event = new ComponentEventImpl("eventType", "someId", context, handler, null, logger); +ComponentEvent event = new ComponentEventImpl("eventType", "someId", context, handler, null, false, mockComponentModel(), logger); assertTrue(event.matches("eventType", "someId", 0)); @@ -153,7 +153,7 @@ public class ComponentEventImplTest extends InternalBaseTestCase replay(); -ComponentEvent event = new ComponentEventImpl("eventType", "someId", context, handler, null, logger); +ComponentEvent event = new ComponentEvent
[08/10] git commit: TAP5-2070 check each page for UnknownActivationContext annotation
TAP5-2070 check each page for UnknownActivationContext annotation Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/d1fabecc Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/d1fabecc Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/d1fabecc Branch: refs/heads/master Commit: d1fabecccf7bd81d0dae8eefda055cf02ee4f981 Parents: 6d70228 Author: Massimo Lusetti Authored: Sat Aug 3 14:06:27 2013 +0200 Committer: Massimo Lusetti Committed: Sat Aug 3 14:06:27 2013 +0200 -- .../pageload/ComponentAssemblerImpl.java| 8 +++-- .../internal/pageload/PageLoaderImpl.java | 7 ++-- .../internal/services/ComponentEventImpl.java | 19 -- .../DefaultRequestExceptionHandler.java | 3 +- .../internal/services/PageActivatorImpl.java| 38 +--- .../structure/ComponentPageElementImpl.java | 25 + 6 files changed, 80 insertions(+), 20 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/d1fabecc/tapestry-core/src/main/java/org/apache/tapestry5/internal/pageload/ComponentAssemblerImpl.java -- diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/pageload/ComponentAssemblerImpl.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/pageload/ComponentAssemblerImpl.java index b56b81c..3e3f27c 100644 --- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/pageload/ComponentAssemblerImpl.java +++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/pageload/ComponentAssemblerImpl.java @@ -32,6 +32,7 @@ import org.apache.tapestry5.model.ComponentModel; import org.apache.tapestry5.model.EmbeddedComponentModel; import org.apache.tapestry5.runtime.RenderCommand; import org.apache.tapestry5.services.ComponentClassResolver; +import org.apache.tapestry5.services.MetaDataLocator; import org.apache.tapestry5.services.Request; import org.apache.tapestry5.services.pageload.ComponentResourceSelector; @@ -60,6 +61,8 @@ class ComponentAssemblerImpl implements ComponentAssembler private final SymbolSource symbolSource; + private final MetaDataLocator metaDataLocator; + private Map publishedParameterToEmbeddedId; private Map embeddedIdToAssembler; @@ -67,7 +70,7 @@ class ComponentAssemblerImpl implements ComponentAssembler public ComponentAssemblerImpl(ComponentAssemblerSource assemblerSource, ComponentInstantiatorSource instantiatorSource, ComponentClassResolver componentClassResolver, Instantiator instantiator, ComponentPageElementResources resources, OperationTracker tracker, - Request request, SymbolSource symbolSource) + Request request, SymbolSource symbolSource, MetaDataLocator metaDataLocator) { this.assemblerSource = assemblerSource; this.instantiatorSource = instantiatorSource; @@ -77,6 +80,7 @@ class ComponentAssemblerImpl implements ComponentAssembler this.tracker = tracker; this.request = request; this.symbolSource = symbolSource; + this.metaDataLocator = metaDataLocator; } public ComponentPageElement assembleRootComponent(final Page page) @@ -103,7 +107,7 @@ class ComponentAssemblerImpl implements ComponentAssembler pageAssembly.weight++; ComponentPageElement newElement = new ComponentPageElementImpl(pageAssembly.page, instantiator, resources, -request, symbolSource); +request, symbolSource, metaDataLocator); pageAssembly.componentName.push(new ComponentName(pageAssembly.page.getName())); http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/d1fabecc/tapestry-core/src/main/java/org/apache/tapestry5/internal/pageload/PageLoaderImpl.java -- diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/pageload/PageLoaderImpl.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/pageload/PageLoaderImpl.java index f54f42e..2f976e2 100644 --- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/pageload/PageLoaderImpl.java +++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/pageload/PageLoaderImpl.java @@ -148,11 +148,13 @@ public class PageLoaderImpl implements PageLoader, ComponentAssemblerSource private final Logger logger; + private final MetaDataLocator metaDataLocator; + public PageLoaderImpl(ComponentInstantiatorSource instantiatorSource, ComponentTemplateSource templateSource, PageElementFactory eleme
[jira] [Updated] (TAP5-2070) Respond with a HTTP 404 if the page is activated with an activation context not explicitly supported by the page itself
[ https://issues.apache.org/jira/browse/TAP5-2070?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Massimo Lusetti updated TAP5-2070: -- Attachment: (was: 0001-TAP5-2070-Implement-logic-for-recognize-requests-to-.patch) > Respond with a HTTP 404 if the page is activated with an activation context > not explicitly supported by the page itself > --- > > Key: TAP5-2070 > URL: https://issues.apache.org/jira/browse/TAP5-2070 > Project: Tapestry 5 > Issue Type: Improvement > Components: tapestry-core >Affects Versions: 5.4 >Reporter: Massimo Lusetti >Assignee: Massimo Lusetti > > The behavior from day one for pages within Tapestry is to being able to serve > requests that come with an activation context with more parameters that the > ones declared by the page itself. > This feature lead the framework to serve requests that comes to URL which are > not explicitly declared by the pages, for example a page named: Super with an > activation event handler method like this one: > onActivate(String character) { ... } > will finely serve requests for: > /super/mario > /super/luigi > /super/wario > /super/waluigi > but it will also serve requests for: > /super/mario/luigi/wario/waluigi > This issue is to change that behavior. > If the page does declare a specific activation event handler method the > corresponding serving URLs should adhere strictly, otherwise a HTTP 404 is > raised. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (TAP5-2070) Respond with a HTTP 404 if the page is activated with an activation context not explicitly supported by the page itself
[ https://issues.apache.org/jira/browse/TAP5-2070?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13728515#comment-13728515 ] Massimo Lusetti commented on TAP5-2070: --- The patch is outdated, I'll commit a new one based on a different implementation > Respond with a HTTP 404 if the page is activated with an activation context > not explicitly supported by the page itself > --- > > Key: TAP5-2070 > URL: https://issues.apache.org/jira/browse/TAP5-2070 > Project: Tapestry 5 > Issue Type: Improvement > Components: tapestry-core >Affects Versions: 5.4 >Reporter: Massimo Lusetti >Assignee: Massimo Lusetti > > The behavior from day one for pages within Tapestry is to being able to serve > requests that come with an activation context with more parameters that the > ones declared by the page itself. > This feature lead the framework to serve requests that comes to URL which are > not explicitly declared by the pages, for example a page named: Super with an > activation event handler method like this one: > onActivate(String character) { ... } > will finely serve requests for: > /super/mario > /super/luigi > /super/wario > /super/waluigi > but it will also serve requests for: > /super/mario/luigi/wario/waluigi > This issue is to change that behavior. > If the page does declare a specific activation event handler method the > corresponding serving URLs should adhere strictly, otherwise a HTTP 404 is > raised. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira