PiRSquared17 / wicket-guide

Automatically exported from code.google.com/p/wicket-guide
0 stars 0 forks source link

Error in section 8.6.6 (CryptoMapper) #4

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In the code example of this section, there is the following comment: "pages and 
resources must be mounted after we have set CryptoMapper"

This is wrong from my experience and does not match what is done in 
wicket-example's RequestMapperApplication. Replacing the root request mapper 
with a mapper which is not an instance of CompoundRequestMapper breaks if done 
before mounting pages.

Application.mount(IRequestMapper) calls getRootRequestMapperAsCompound() which 
transfers the added root CryptoMapper to the same level as other mappers later 
on.

Original issue reported on code.google.com by berni...@gmail.com on 3 Apr 2013 at 3:16

GoogleCodeExporter commented 9 years ago

Original comment by an.delb...@gmail.com on 3 Apr 2013 at 8:25

GoogleCodeExporter commented 9 years ago
What you say it's true for HttpsMapper, ehich is used in 
RequestMapperApplication. But if you try to set CryptoMapper as root mapper 
AFTER mounting a page to a specific path, this last won't work (i.e. the 
mounted page won't be served at the specific path). Try to use the following 
code in a quickstart project:

public void init()
{
super.init();
//pages and resources must be mounted after we have set CryptoMapper
mountPage("/foo/", HomePage.class);

setRootRequestMapper(new CryptoMapper(getRootRequestMapper(), this));

}

HomePage path will be encrypted and not plain '<app path>/foo' 

Original comment by an.delb...@gmail.com on 5 Apr 2013 at 10:42

GoogleCodeExporter commented 9 years ago
You're completely right! I missed the whole point of using CryptoMapper which 
is to encrypt NON-mapped page paths and leave mapped page paths alone.

In my case, I needed to build a "true" root mapper which receives all requests 
(like HttpsMapper) and I used section 8.6.6 as an example. This obviously 
didn't work as I intended for the reasons outlined above, but I didn't stop to 
think that things are different for CryptoMapper.

Sorry for the confusion!

Original comment by berni...@gmail.com on 5 Apr 2013 at 3:10

GoogleCodeExporter commented 9 years ago

Original comment by an.delb...@gmail.com on 5 Apr 2013 at 3:27