[ 
https://issues.apache.org/jira/browse/WICKET-4870?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Christoph Knafl updated WICKET-4870:
------------------------------------

    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 till 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.
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.

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

  was:
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 till 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.
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.

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

    
> Problem mixing MountPath, new FooPage(...) and Struts-Framework
> ---------------------------------------------------------------
>
>                 Key: WICKET-4870
>                 URL: https://issues.apache.org/jira/browse/WICKET-4870
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 6.2.0
>            Reporter: Christoph Knafl
>            Priority: Minor
>
> 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 till 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.
> 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.
> 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

--
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

Reply via email to