Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-4870

Problem mixing MountPath, new FooPage(...) and Struts-Framework

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Invalid
    • Affects Version/s: 6.2.0
    • Fix Version/s: None
    • Component/s: wicket
    • Labels:

      Description

      Hi!

      I am not quite sure if it is a bug, but let me tell you about the problem.

      We are having two frameworks for one project (wicket 1.4 and struts). Was no problem until now.
      We want to migrate the whole client to wicket 6.2.

      From my struts pages I have a URL like http://localhost:8080/application/wicket/foo?id=1111 to my wicket-page.
      That works, because of the annotation MountPath with the value "foo" on the Pageclass.

      And on this wicket page i am linking to another wicketpage, but not with mountpath (I don't need it here), but with setResponsePage(new BarPage());.

      Now my URL is something like http://localhost:8080/application/wicket/wicket/page?3.
      This is the result of PageInstanceMapper mapHandler....L:137-141

      That would be OK, if my whole application would be wicket. But from these wicket-pages I am also linking to Struts-Pages with the prefix "../". Because "wicket/" is two times in the URL now, this doesn't work anymore and results in a not-found exception.

      Strange thing is, when I am annotating my pageclass with MountPath(value = "wtf"), it works perfectly, although I am calling this page with setResponsePage(new Page()) and not via MountPath. Then the MountedMapper is used for the URL-creation.

      My workaround is (but thats really dirty, I guess):
      overriding the method newMapperContext() in Application.

      @Override
      protected IMapperContext newMapperContext() {
      return new DefaultMapperContext() {
      @Override
      public String getNamespace() {
      String path = RequestCycle.get().getRequest().getUrl().getPath();

      if ((!path.contains("wicket") || path.contains("resource")) && !path.contains("foo"))

      { return "wicket"; }

      return StringUtils.EMPTY;
      };
      };
      }

      Regards
      Christoph Knafl

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              cknafl Christoph Knafl
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: