You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by andrea del bene <an...@gmail.com> on 2016/03/23 13:22:45 UTC

Path rewriting

Hi,

lately I had to struggle with a default behavior of Wicket that I think 
can be improved. Let's start from the problem: relative paths starting 
with dot-slash (./) are always rewritten by RelativePathPrefixHandler. 
This can be a problem if my app or page is mounted at specific path and 
I simply want to use an anchor starting with ./
I'd like to modify RelativePathPrefixHandler in order to prevent such 
rewriting, like we already do for absolute paths. This change doesn't 
break any unit test but I'd like to hear your opinion. Maybe someone of 
you knows why this kind of paths must be rewritten.
If you need a quickstart project showing the problem I can provide it.

Thank you.

Andrea.

Re: Path rewriting

Posted by andrea del bene <an...@gmail.com>.
Thank you, I've tried it but I've forgotten to rebuild the project :)

On 23/03/2016 13:26, Martin Grigorov wrote:
> In such cases you need to use <wicket:link>.


Re: Path rewriting

Posted by Martin Grigorov <mg...@apache.org>.
Hi Andrea,

On Wed, Mar 23, 2016 at 1:22 PM, andrea del bene <an...@gmail.com>
wrote:

> Hi,
>
> lately I had to struggle with a default behavior of Wicket that I think
> can be improved. Let's start from the problem: relative paths starting with
> dot-slash (./) are always rewritten by RelativePathPrefixHandler. This can
> be a problem if my app or page is mounted at specific path and I simply
> want to use an anchor starting with ./
>

In such cases you need to use <wicket:link>.


> I'd like to modify RelativePathPrefixHandler in order to prevent such
> rewriting, like we already do for absolute paths. This change doesn't break
> any unit test but I'd like to hear your opinion. Maybe someone of you knows
> why this kind of paths must be rewritten.
> If you need a quickstart project showing the problem I can provide it.
>

The re-writing is needed because such url could be in a Panel and that
panel could be used in PageA which is mounted at /some/path/to/A and also
in PageB which is at /B.
Relative path like ./something/else will resolve to
/some/path/to/something/else or to /something/else.


>
> Thank you.
>
> Andrea.
>