that class used to have a javadoc that specified it was important that
it is the last mount-related call in init()

-igor

On Mon, Sep 24, 2012 at 7:47 AM, Martin Grigorov <[email protected]> wrote:
> Hi,
>
> https://issues.apache.org/jira/browse/WICKET-4780 shows an interesting
> problem with wrapping of request mappers.
>
> The code is:
> public void init() {
>   super.init();
>   setRootRequestMapper(new CryptoMapper(getRootRequestMapper(), this));
>   mountPage("/home", HomePage.class);
> }
>
> and this leads to:
> BufferedResponseMapper is wrapped as part of SystemMapper in CryptoMapper.
> Later when mountPage("/home") is called a new CompoundRequestMapper is
> created with CryptoMapper as a member and a MountedMapper for HomePage
> is prepended to it.
> So we have : CompoundRequestMapper(MountedMapper(/home),
> CryptoMapper(SystemMapper(BufferedResponseMapper, /* other system
> mappers */ )))
>
> When a request with url : home?0 comes MountedMapper(/home) is asked
> first and it matches, so BufferedResponseMapper is not asked at all.
> Later when starting to render the reported WARN is issued because now
> we check for stored response.
>
>
> The only solution that I see is to do smarter wrapping at
> #setRootRequestMapper().
> We can split SystemMapper on two sub mappers - one with
> RestartResponseAtInterceptPageException.MAPPER and
> BufferedResponseMapper (BRM),and another with the rest system mappers
> which are also used to generate Urls.
> When #setRootRequestMapper() is called we should create such compound
> mapper that will always use RRAIPE.MAPPER and BRM before any other
> mapper.
>
> Do you see other solutions which are simpler than this one ?
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com

Reply via email to