Tapestry 5
  1. Tapestry 5
  2. TAP5-2070

Respond with a HTTP 404 if the page is activated with an activation context not explicitly supported by the page itself

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.4
    • Fix Version/s: 5.4
    • Component/s: tapestry-core
    • Labels:
      None

      Description

      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.

        Issue Links

          Activity

          Hide
          Hudson added a comment -

          FAILURE: Integrated in tapestry-trunk-freestyle #1128 (See https://builds.apache.org/job/tapestry-trunk-freestyle/1128/)
          TAP5-2070 fix some tests (mlusetti: rev 6460e445c58dc53b23f0c749b9c1cea58e093f36)

          • tapestry-core/src/test/java/org/apache/tapestry5/internal/structure/ComponentPageElementImplTest.java
          • tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ComponentEventImplTest.java
          Show
          Hudson added a comment - FAILURE: Integrated in tapestry-trunk-freestyle #1128 (See https://builds.apache.org/job/tapestry-trunk-freestyle/1128/ ) TAP5-2070 fix some tests (mlusetti: rev 6460e445c58dc53b23f0c749b9c1cea58e093f36) tapestry-core/src/test/java/org/apache/tapestry5/internal/structure/ComponentPageElementImplTest.java tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ComponentEventImplTest.java
          Hide
          Hudson added a comment -

          FAILURE: Integrated in tapestry-trunk-freestyle #1127 (See https://builds.apache.org/job/tapestry-trunk-freestyle/1127/)
          TAP5-2070 better to take no activation handler method as a way to accept empty activation context (mlusetti: rev 28e3321f7865fb74cd36c78f3911bfbd9750ae77)

          • tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PageActivatorImpl.java
            TAP5-2070 tests on basic check on activation context with new annotation (mlusetti: rev 0ae1d1170f93f7570a3340a0d07185c79a300acb)
          • tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
          • tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/UnknownActivationContextDemo.java
          • tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
          • tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/UnknownActivationContextDemo.tml
            TAP5-2070 new page for base tests (mlusetti: rev 7de82f531c875bf916385c5dc1fedd64687af7d6)
          • tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/KnownActivationContextDemo.java
          • tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/KnownActivationContextDemo.tml
            TAP5-2070 show new pages in main intergation test app (mlusetti: rev 83fcdca312281c36399ed69773f55d677e05f6fd)
          • tapestry-core/src/test/app1/Index.tml
            TAP5-2070 new test integration app for activation context check (mlusetti: rev 7e058593bf074416bd8af97a66a1dc770021e8bd)
          • tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx/services/AppModule.java
          • tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx/pages/Index.java
          • tapestry-core/src/test/resources/org/apache/tapestry5/integration/activationctx/pages/Index.tml
          • tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx/pages/OneContext.java
          • tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx/pages/NoContext.java
          • tapestry-core/src/test/resources/org/apache/tapestry5/integration/activationctx/pages/NoContext.tml
          • tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx/components/Layout.java
          • tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx/pages/TwoContext.java
          • tapestry-core/src/test/activationctx/WEB-INF/web.xml
          • tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx/ActivationContextintegrationTests.java
          • tapestry-core/src/test/resources/org/apache/tapestry5/integration/activationctx/pages/OneContext.tml
          • tapestry-core/src/test/resources/org/apache/tapestry5/integration/activationctx/components/Layout.tml
          • tapestry-core/src/test/resources/org/apache/tapestry5/integration/activationctx/pages/TwoContext.tml
            TAP5-2070 new test integration app for activation context check with inverse behavior (all enabled, some excluded) (mlusetti: rev 2d5fb4b77e7250b5d12ba23fc1a48075b429d034)
          • tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/pages/ContextUnchecked.java
          • tapestry-core/src/test/resources/org/apache/tapestry5/integration/activationctx2/pages/Index.tml
          • tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/services/AppModule.java
          • tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/pages/ContextChecked.java
          • tapestry-core/src/test/resources/org/apache/tapestry5/integration/activationctx2/pages/ContextUnchecked.tml
          • tapestry-core/src/test/resources/org/apache/tapestry5/integration/activationctx2/pages/ContextChecked.tml
          • tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/pages/Index.java
          • tapestry-core/src/test/activationctx2/WEB-INF/web.xml
          • tapestry-core/src/test/resources/org/apache/tapestry5/integration/activationctx2/components/Layout.tml
          • tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/ActivationContextIntegrationTests2.java
          • tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/components/Layout.java
            TAP5-2070 hook new test apps into test chain (mlusetti: rev a9173f9a7c86f2b65fa2b4d9f1b430f2e40a161b)
          • tapestry-core/src/test/conf/testng.xml
          Show
          Hudson added a comment - FAILURE: Integrated in tapestry-trunk-freestyle #1127 (See https://builds.apache.org/job/tapestry-trunk-freestyle/1127/ ) TAP5-2070 better to take no activation handler method as a way to accept empty activation context (mlusetti: rev 28e3321f7865fb74cd36c78f3911bfbd9750ae77) tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PageActivatorImpl.java TAP5-2070 tests on basic check on activation context with new annotation (mlusetti: rev 0ae1d1170f93f7570a3340a0d07185c79a300acb) tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/UnknownActivationContextDemo.java tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/UnknownActivationContextDemo.tml TAP5-2070 new page for base tests (mlusetti: rev 7de82f531c875bf916385c5dc1fedd64687af7d6) tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/KnownActivationContextDemo.java tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/KnownActivationContextDemo.tml TAP5-2070 show new pages in main intergation test app (mlusetti: rev 83fcdca312281c36399ed69773f55d677e05f6fd) tapestry-core/src/test/app1/Index.tml TAP5-2070 new test integration app for activation context check (mlusetti: rev 7e058593bf074416bd8af97a66a1dc770021e8bd) tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx/services/AppModule.java tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx/pages/Index.java tapestry-core/src/test/resources/org/apache/tapestry5/integration/activationctx/pages/Index.tml tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx/pages/OneContext.java tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx/pages/NoContext.java tapestry-core/src/test/resources/org/apache/tapestry5/integration/activationctx/pages/NoContext.tml tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx/components/Layout.java tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx/pages/TwoContext.java tapestry-core/src/test/activationctx/WEB-INF/web.xml tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx/ActivationContextintegrationTests.java tapestry-core/src/test/resources/org/apache/tapestry5/integration/activationctx/pages/OneContext.tml tapestry-core/src/test/resources/org/apache/tapestry5/integration/activationctx/components/Layout.tml tapestry-core/src/test/resources/org/apache/tapestry5/integration/activationctx/pages/TwoContext.tml TAP5-2070 new test integration app for activation context check with inverse behavior (all enabled, some excluded) (mlusetti: rev 2d5fb4b77e7250b5d12ba23fc1a48075b429d034) tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/pages/ContextUnchecked.java tapestry-core/src/test/resources/org/apache/tapestry5/integration/activationctx2/pages/Index.tml tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/services/AppModule.java tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/pages/ContextChecked.java tapestry-core/src/test/resources/org/apache/tapestry5/integration/activationctx2/pages/ContextUnchecked.tml tapestry-core/src/test/resources/org/apache/tapestry5/integration/activationctx2/pages/ContextChecked.tml tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/pages/Index.java tapestry-core/src/test/activationctx2/WEB-INF/web.xml tapestry-core/src/test/resources/org/apache/tapestry5/integration/activationctx2/components/Layout.tml tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/ActivationContextIntegrationTests2.java tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/components/Layout.java TAP5-2070 hook new test apps into test chain (mlusetti: rev a9173f9a7c86f2b65fa2b4d9f1b430f2e40a161b) tapestry-core/src/test/conf/testng.xml
          Hide
          Hudson added a comment -

          FAILURE: Integrated in tapestry-trunk-freestyle #1125 (See https://builds.apache.org/job/tapestry-trunk-freestyle/1125/)
          TAP5-2070 actually I want to check for an exact activation handler method (mlusetti: rev 0e2fc3605e706c88d4c07245e9c2641cb0979bbf)

          • tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PageActivatorImpl.java
          Show
          Hudson added a comment - FAILURE: Integrated in tapestry-trunk-freestyle #1125 (See https://builds.apache.org/job/tapestry-trunk-freestyle/1125/ ) TAP5-2070 actually I want to check for an exact activation handler method (mlusetti: rev 0e2fc3605e706c88d4c07245e9c2641cb0979bbf) tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PageActivatorImpl.java
          Hide
          Hudson added a comment -

          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
          Show
          Hudson added a comment - 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
          Hide
          Massimo Lusetti added a comment -

          The patch is outdated, I'll commit a new one based on a different implementation

          Show
          Massimo Lusetti added a comment - The patch is outdated, I'll commit a new one based on a different implementation
          Hide
          Lenny Primak added a comment -

          I would love to get this fix incorporated. I currently use this code in the index page to work around this issue:

          8 /**
          9 * Restore 404 Not Found errors
          10 * @param context
          11 * @return
          12 */
          13 HttpError onActivate(EventContext context)
          14 {
          15 if (context.getCount() == 0)
          16

          { 17 return null; 18 }

          19
          20 return new HttpError(404, "Resource not found.");
          21 }

          Show
          Lenny Primak added a comment - I would love to get this fix incorporated. I currently use this code in the index page to work around this issue: 8 /** 9 * Restore 404 Not Found errors 10 * @param context 11 * @return 12 */ 13 HttpError onActivate(EventContext context) 14 { 15 if (context.getCount() == 0) 16 { 17 return null; 18 } 19 20 return new HttpError(404, "Resource not found."); 21 }
          Hide
          Massimo Lusetti added a comment -

          Any comment on this?!

          Does we want to ship with the current behavior?

          Show
          Massimo Lusetti added a comment - Any comment on this?! Does we want to ship with the current behavior?
          Hide
          Massimo Lusetti added a comment -

          Patch that implement the new behavior but keep it disabled.
          It can be enabled by a configuration symbol.

          Show
          Massimo Lusetti added a comment - Patch that implement the new behavior but keep it disabled. It can be enabled by a configuration symbol.

            People

            • Assignee:
              Massimo Lusetti
              Reporter:
              Massimo Lusetti
            • Votes:
              3 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development