tags:

views:

448

answers:

3

The Problem: Using one of Wickets url mounting strategies i can do the following url (as an example)

http://somedomain.com/mount-path/desiredname

what i would like to do is

http://somedomain.com/desiredname

desiredname would be e.g. pages or posts. But with Wicket I must use a mount-path first.

Can anybody point me into the right direction, either using a different mounting strategy or a filter setup.

E.g a fallback class for all urls within somedomain.com, from thereone the code should be simple.

thanks.

A: 

But if you map your Wicket Filter to "/", won't it work as you expect?

If not, this is probably what you need:

http://tuckey.org/urlrewrite/

Peter Thomas
thank you for the link.wicket filter mapping is set to: <url-pattern>/*</url-pattern>when I mount with mount-path it's no problem. All other urls result in a 404. (and catching a 404 to find a specific site as a regualr usecase does not seem that elegant).
nheid
this works if you use both filters and set the url rewrite to redirect. otherwise the wicket filter does not recognize the rewritten url.
nheid
*bump* just see the new answer I posted
Peter Thomas
+1  A: 

You might try to use Wicketstuff annotation library

@MountPath(path = "/")
@MountMixedParam(parameterNames = { "action", "accountID" })

Also you can implement custom AbstractRequestTargetUrlCodingStrategy

I'm not sure in this advices.

leonidv
+1  A: 

I'm pretty sure this blog post answers your question :)

http://blog.jteam.nl/2010/02/24/wicket-root-mounts/

Peter Thomas
this is excellent, thank you.
nheid