You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by cknafl <ch...@gmail.com> on 2012/11/30 09:07:48 UTC

Wicket and Struts together have a problem when not adding mountpath to the Wicket-Page

Hi!

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 UR



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-and-Struts-together-have-a-problem-when-not-adding-mountpath-to-the-Wicket-Page-tp4654359.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket and Struts together have a problem when not adding mountpath to the Wicket-Page

Posted by cknafl <ch...@gmail.com>.
Just for info:

I updated to Wicket 6.5 and now it works fine :).
MountPath, setResponsePage() and Struts together working now without
problems.

Regards
Christoph



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-and-Struts-together-have-a-problem-when-not-adding-mountpath-to-the-Wicket-Page-tp4654359p4656396.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket and Struts together have a problem when not adding mountpath to the Wicket-Page

Posted by cknafl <ch...@gmail.com>.
I am trying some hacks now to get the application work well and I am looking
forward to just have wicket in my application :)

I don't even know why overriding getDefaultNameSpace(){ return "";} doesn't
work. The resources js or css cannot be found anymore, so the will be
searched in "/wicket/wicket/" I guess...
Well, some kind of strange things happening here...

Regards and thanks for the help!
Christoph



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-and-Struts-together-have-a-problem-when-not-adding-mountpath-to-the-Wicket-Page-tp4654359p4654579.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket and Struts together have a problem when not adding mountpath to the Wicket-Page

Posted by Martin Grigorov <mg...@apache.org>.
On Tue, Dec 4, 2012 at 10:29 AM, cknafl <ch...@gmail.com> wrote:

> I am currently overwriting getNamespace(). But that is really dirty. When I
> make this method to return "" everytime, then my css, js and so on cannot
> be
> found anymore, that I added with renderHead(..).
> So I implemented an if-else logic:
> if(path.contains("resource")
>    return "wicket";
> ...
>

Just return "mine" or anything that looks non-dirty to you.


>
> Can you tell me how you would use this
> UrlRenderer#renderContextRelativeUrl() instead of setting my own
> UrlRenderer
> please?
>

class StrutsModel extends AbstractReadOnlyModel<String> {
  private final String relativeUrl;

  public StrutsModel(String relUrl) {
     this.relativeUrl = relUrl;
  }
 @Override
  public String getObject() {
     return
RequestCycle.get().getUrlRenderer().renderContextRelativeUrl("struts/" +
relativeUrl);
  }
}

class StrutsLink extends ExternalLink {

  public StrutsLink(String id, String strutsUrl) {
     super(id, new StrutsModel(strutsUrl))
  }
}

add(new StrutsLink("linkId", "struts.html");


>
> Regards
> Christoph
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Wicket-and-Struts-together-have-a-problem-when-not-adding-mountpath-to-the-Wicket-Page-tp4654359p4654461.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Re: Wicket and Struts together have a problem when not adding mountpath to the Wicket-Page

Posted by cknafl <ch...@gmail.com>.
I am currently overwriting getNamespace(). But that is really dirty. When I
make this method to return "" everytime, then my css, js and so on cannot be
found anymore, that I added with renderHead(..).
So I implemented an if-else logic:
if(path.contains("resource") 
   return "wicket";
...

Can you tell me how you would use this
UrlRenderer#renderContextRelativeUrl() instead of setting my own UrlRenderer
please?

Regards
Christoph



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-and-Struts-together-have-a-problem-when-not-adding-mountpath-to-the-Wicket-Page-tp4654359p4654461.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket and Struts together have a problem when not adding mountpath to the Wicket-Page

Posted by Martin Grigorov <mg...@apache.org>.
On Tue, Dec 4, 2012 at 9:58 AM, cknafl <ch...@gmail.com> wrote:

> Could be a possibility. I am trying it right now, I have to overwrite
> newUrlRenderer in RequestCycle but how do I set my own RequestCycle?
>
> What I do not understand is that this behavior changed from wicket1.4 to
> wicket6.
>

I'm not sure that you need a custom UrlRenderer but if you do then
see org.apache.wicket.Application#setRequestCycleProvider


>
> When I call a page with mountpath(value="bla") then I get a URL like
> http://.../wicket/bla. When on this page is a button that makes a
> setResponsePage(otherpage) I get a URL like http://
> .../wicket/wicket/page?1.
>
> One "/wicket/" is added altough I was in Wicket.
>

Yes. Wicket uses 'wicket' namespace for all pages which has no explicit
mount path.
See org.apache.wicket.Application#newMapperContext
and org.apache.wicket.DefaultMapperContext#getNamespace


>
> You know what I mean.
>
> Regards
> Christoph
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Wicket-and-Struts-together-have-a-problem-when-not-adding-mountpath-to-the-Wicket-Page-tp4654359p4654458.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Re: Wicket and Struts together have a problem when not adding mountpath to the Wicket-Page

Posted by cknafl <ch...@gmail.com>.
Could be a possibility. I am trying it right now, I have to overwrite
newUrlRenderer in RequestCycle but how do I set my own RequestCycle?

What I do not understand is that this behavior changed from wicket1.4 to
wicket6.

When I call a page with mountpath(value="bla") then I get a URL like
http://.../wicket/bla. When on this page is a button that makes a
setResponsePage(otherpage) I get a URL like http://.../wicket/wicket/page?1.

One "/wicket/" is added altough I was in Wicket.

You know what I mean.

Regards
Christoph



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-and-Struts-together-have-a-problem-when-not-adding-mountpath-to-the-Wicket-Page-tp4654359p4654458.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket and Struts together have a problem when not adding mountpath to the Wicket-Page

Posted by Martin Grigorov <mg...@apache.org>.
Well, Wicket has no idea that you use Struts and even less where are the
pages managed by Struts.

What about the approach with UrlRenderer#renderContextRelativeUrl() ?


On Mon, Dec 3, 2012 at 3:10 PM, cknafl <ch...@gmail.com> wrote:

> Yeah, that is working but that's in fact also a workaround.
>
> I don't want to mount all my pages. Or do I understand something wrong...
> My webapp has a login and should not have any mountpaths... (except of
> Loginpage itself).
>
> Kind Regards
> Christoph
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Wicket-and-Struts-together-have-a-problem-when-not-adding-mountpath-to-the-Wicket-Page-tp4654359p4654426.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Re: Wicket and Struts together have a problem when not adding mountpath to the Wicket-Page

Posted by cknafl <ch...@gmail.com>.
Yeah, that is working but that's in fact also a workaround.

I don't want to mount all my pages. Or do I understand something wrong...
My webapp has a login and should not have any mountpaths... (except of
Loginpage itself).

Kind Regards
Christoph



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-and-Struts-together-have-a-problem-when-not-adding-mountpath-to-the-Wicket-Page-tp4654359p4654426.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket and Struts together have a problem when not adding mountpath to the Wicket-Page

Posted by Martin Grigorov <mg...@apache.org>.
https://issues.apache.org/jira/browse/WICKET-4870

It seems the problem is still unresolved. You have asked the same in a
ticket.
Did you try my proposals ?


On Fri, Nov 30, 2012 at 2:04 PM, cknafl <ch...@gmail.com> wrote:

> I found nothing with struts and wicket... :(
>
> Maybe somebody knows the other topic, where the problem is solved?
> Or maybe somone could post the solution here again :)
>
> Regards
> Christoph
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Wicket-and-Struts-together-have-a-problem-when-not-adding-mountpath-to-the-Wicket-Page-tp4654359p4654377.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Re: Wicket and Struts together have a problem when not adding mountpath to the Wicket-Page

Posted by cknafl <ch...@gmail.com>.
I found nothing with struts and wicket... :(

Maybe somebody knows the other topic, where the problem is solved?
Or maybe somone could post the solution here again :)

Regards
Christoph



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-and-Struts-together-have-a-problem-when-not-adding-mountpath-to-the-Wicket-Page-tp4654359p4654377.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org