Re: CryptoMapper and mounted pages.

2013-10-07 Thread Roman Grigoriadi
Hi Dmitry!

Thank you for your suggestion, but I can't see how bundled
BookmarkableCryptoMapper could help in my case. In my quickstart on 6.10.0
CryptoMapper is never given a word, so it will never join the mapper chain,
during mapHandler(..) in case of bookmarkable page, disregarding its
implementation.

I'll try to illustrate the behavior:
in my Application.init() after calling /setRootRequestMapper(new
CryptoMapper(getRootRequestMapper(), this));/ the mappers hierarchy is like
this:

- CryptoMapper
|
|-- SystemMapper
  | Collection of Wicket internal mappers

This state it is fine, CryptoMapper is set as root and is decorating all
request / handler processing to wicket internal mapper and therefore encodes
/ decodes urls produced by them.

but next line in application init, after I set /mountPage(nice/nicer
BookedPage.class);/ the hierarchy is like this:

- CompoundRequestMapper 
|
|--CryptoMapper
|   |--SystemMapper
||--Wicket mappers collection
|
|--MountedMapper

To describe the problem - CompoundRequestMapper (set as root) is processing
mapHandler(ListenerInterfaceRequestHandler), executes its mappers in reverse
order (only 2 in my case) until one returns non-null URL, so MountedMapper
is executed first, returns a non-null URL and than the thread is returned
back to the callers (component.urlFor(), etc, during rendering), *but
CryptoMapper is never invited to say Hi!*

To quick-fix my case it is enough to:

public Url mapHandler(IRequestHandler requestHandler) {
if (requestHandler instanceof RenderPageRequestHandler) {
return super.mapHandler(requestHandler);
}
return null;
}

in a MountedMapper extension to encode all, with an exception for URL in a
web browser. But anyway I don't see the reason, why it must be done manually
and why Wicket should silently bypassing all URL encrypting for bookmarkable
pages. 

Looking forward next shooting session! Roman.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/CryptoMapper-and-mounted-pages-tp4661676p4661730.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: CryptoMapper and mounted pages.

2013-10-04 Thread Martin Grigorov
Hi,

There is a ticket with similar symptoms:
https://issues.apache.org/jira/browse/WICKET-5326
I think the most easier way is to extend CryptoMapper and call
super#mapHandler() only for IPageClassRequestHandlers for pages in a
whitelist. E.g. you can annotate them.


On Thu, Oct 3, 2013 at 3:09 PM, Roman Grigoriadi roman.grigori...@gmail.com
 wrote:

 Hello Wicket users!

 I am trying to make a CryptoMapper working for a mounted page, in a way,
 that the URL in browser would be unencrypted, but all the other stuff like
 ListenerInterface links urls will be encrypted.

 I am using a wicket 1.5.10, but I tried to reproduce it on a quickstart
 project with 6.10.0 and it behaves the same, which is - MountedMapper
 generates urls for all components and CryptoMapper is skipped

 /The question is: is it an intended behavior in case of MountedMapper?/

 Here is a bit of code:

 //Applications init:

 setRootRequestMapper(new CryptoMapper(getRootRequestMapper(), this));
 mountPage(/nice/nicer, BookedPage.class);

 First line sets CryptoMapper as root with wrapped SystemMapper.
 Second internally sets *CompoundRequestMapper as root* with first in
 collection CryptoMapper and second MountedMapper.

 Now when i enter localhost/nice/nicer in browser url, a BookedPage is
 being rendered, and when it renders its only component - AjaxLink, it asks
 for an URL for its ListenerInterfaceRequestsHandler. As a root mapper,
 CompoundRequestMapper asks first a MountedMapper and as it gets an URL from
 it, CryptoMapper is never asked to encrypt it after.

 I figured out to use a CustomMountedMapper and return null in
 mapHandler(..)
 for all handlers, but the RenderPageRequestHandler, but it doesn't feel
 being correct to me.

 Greetings, Roman.



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/CryptoMapper-and-mounted-pages-tp4661676.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Re: CryptoMapper and mounted pages.

2013-10-04 Thread Roman Grigoriadi
Hi Martin,

thanks for suggestion, but it appears to me, that the problem actually is
that the CryptoMapper is not set as root if you call any of mountPage(..),
after setting CryptoMapper as root mapper. I suppose your suggestion would
work if MountedMappers will be added in a SystemMapper collection (which is
decorated by CryptoMapper)  instead of a CompoundMapper, which is not.

I'll comment further on linked ticket, you provided.

Cheers, Roman.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/CryptoMapper-and-mounted-pages-tp4661676p4661696.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: CryptoMapper and mounted pages.

2013-10-04 Thread Martin Grigorov
On Fri, Oct 4, 2013 at 10:17 AM, Roman Grigoriadi 
roman.grigori...@gmail.com wrote:

 Hi Martin,

 thanks for suggestion, but it appears to me, that the problem actually is
 that the CryptoMapper is not set as root if you call any of
 mountPage(..),
 after setting CryptoMapper as root mapper. I suppose your suggestion would
 work if MountedMappers will be added in a SystemMapper collection (which is
 decorated by CryptoMapper)  instead of a CompoundMapper, which is not.


Yes. This is by design.
If the current root mapper is not ICompoundRequestMapper then Wicket
creates one automatically.
This is a feature some applications use.



 I'll comment further on linked ticket, you provided.

 Cheers, Roman.



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/CryptoMapper-and-mounted-pages-tp4661676p4661696.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




CryptoMapper and mounted pages.

2013-10-03 Thread Roman Grigoriadi
Hello Wicket users!

I am trying to make a CryptoMapper working for a mounted page, in a way,
that the URL in browser would be unencrypted, but all the other stuff like
ListenerInterface links urls will be encrypted.

I am using a wicket 1.5.10, but I tried to reproduce it on a quickstart
project with 6.10.0 and it behaves the same, which is - MountedMapper
generates urls for all components and CryptoMapper is skipped

/The question is: is it an intended behavior in case of MountedMapper?/

Here is a bit of code:

//Applications init:

setRootRequestMapper(new CryptoMapper(getRootRequestMapper(), this));
mountPage(/nice/nicer, BookedPage.class);

First line sets CryptoMapper as root with wrapped SystemMapper.
Second internally sets *CompoundRequestMapper as root* with first in
collection CryptoMapper and second MountedMapper.

Now when i enter localhost/nice/nicer in browser url, a BookedPage is
being rendered, and when it renders its only component - AjaxLink, it asks
for an URL for its ListenerInterfaceRequestsHandler. As a root mapper,
CompoundRequestMapper asks first a MountedMapper and as it gets an URL from
it, CryptoMapper is never asked to encrypt it after.

I figured out to use a CustomMountedMapper and return null in mapHandler(..)
for all handlers, but the RenderPageRequestHandler, but it doesn't feel
being correct to me.

Greetings, Roman.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/CryptoMapper-and-mounted-pages-tp4661676.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org