https://cwiki.apache.org/WICKET/how-to-do-things-in-wicket.html
.



On Mon, Sep 19, 2011 at 1:57 AM, Bas Gooren <b...@iswd.nl> wrote:

> After quite a lot of searching and testing, I've finally been able to get
> things working.
>
> In the end, I was able to solve my problem in the most logical place, which
> once again shows how great Wicket is!
> I've created an AbsoluteUrlRenderer (which extends the default
> UrlRenderer).
>
> What is a good place to share this code so other wicket users can save
> themselves the time?
>
> Op 16-9-2011 1:20, schreef Bas Gooren:
>
>  Ok, I've been playing around with this, and it doesn't work.
>>
>> WebPageRenderer#respond() compares the current url to the target url.
>> The current url is always normalized (without context path), so if my
>> absolute mapper generates a target url which is absolute, and as such
>> includes the context path and the filter path, wicket initiates a redirect.
>>
>> Then, on the next request, the exact same thing happens, so we end up in a
>> redirect loop.
>>
>> It appears that the only way to achieve what I want is to override the
>> UrlRenderer and it's method #renderRelativeUrl(). Basically, all that is
>> required there is to prefix the context path and filter path.
>>
>> Op 15-9-2011 1:58, schreef Igor Vaynberg:
>>
>>> that sounds correct.
>>>
>>> essentially this is the same as running the url through
>>> requestcycle.geturlrenderer().**renderFullUrl(url) but with a different
>>> prefix
>>>
>>> -igor
>>>
>>> On Wed, Sep 14, 2011 at 4:54 PM, Bas Gooren<b...@iswd.nl>  wrote:
>>>
>>>> Hi,
>>>>
>>>> Another wicket 1.5 migration question:
>>>> In 1.4 we created a IRequestCodingStrategy decorator which, in encode(),
>>>> translates all urls to be absolute.
>>>> We did this by checking if the url started with "/", and if not,
>>>> removing
>>>> all occurrences of "../" and "./".
>>>>
>>>> To handle being behind a reverse proxy, the constructor optionally
>>>> accepted
>>>> a prefix which was always prepended.
>>>>
>>>> In 1.5 it seems this could be implemented as an IRequestMapper which
>>>> decorates the root mapper.
>>>> However, since we are passed a Url instead of a String, and a lot has
>>>> changed surrounding url generation, what is the best way to make all
>>>> urls
>>>> absolute?
>>>>
>>>> I'm thinking:
>>>> - check Url.isAbsolute()
>>>> - remove segments which are ".." or "."
>>>> - prepend prefix segments
>>>>
>>>> Is this the correct way?
>>>>
>>>> Sebastian
>>>>
>>>>  ------------------------------**------------------------------**
>>> ---------
>>> To unsubscribe, e-mail: 
>>> users-unsubscribe@wicket.**apache.org<users-unsubscr...@wicket.apache.org>
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>

Reply via email to