Incorrect handling of mounted URLs internally leads to problems

2010-09-17 Thread Bjorn S

We've recently experienced some problems with mounted URLs where the wicket
internals incorrectly handle the mounting, specifically this problem occurs
due to lazy decoding and encoding of mounted URLs when redirecting.

Example:
We have two pages called ArticlePage  ArticlePageProxy, which either takes
an article id parameter from the URL or decodes the requested mount url and
gets the parameters from a database. We've found this to be a very handy way
of dealing with the need for clean URLs and makes the system nice and
extensible.
The customer can for instance write an article about contact details and
mount that article under /contact and when that will appear as a fully
functional page displaying the article.

Problems occur when users start to use multi-tab browsing, what happens when
a user opens a new tab and points it at say /contact?; Wicket will detect
that this is a new tab and open a new pagemap, the page will begin to render
but contains a redirect to the new URL with the pagemap parameter included
in URL.

This is where the error occurs, the redirect URL has been created by
decoding the requesting page (ArticlePage for instance) and then re-encoding
it if it is mounted. Now say for example that our customer also mounts
/alpha-code, and /alpha-code is mounted before /contact in wicket.

Now whenever a user opens a new tab to /contact, he is redirected to
/alpha-code with the pagemap parameter. Now this might not seem like a
problem to wicket because they are both the same class, but if a page is
mounted on several URLs it is likely that the requesting URL is somehow
important to the page and should be kept intact.

IRequestTargetUrlCodingStrategy getMountEncoder(IRequestTarget
requestTarget) line 1057 of WebRequestCodingStrategy (in v.1.4.9) is never
supplied with the initial URL for the request and thus can't make an
intelligent decision. I have been unable to find exactly where in the source
code the redirect with the new pagemap occurs however at that point I'd
presume the Request is still intact and the requesting URL could simply be
plucked out from there.

I'll try to put up a Jira and example over the weekend. If anyone know where
the redirect occurs and if its possible to overload it with a more
intelligent option, that would be much appreciated.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Incorrect-handling-of-mounted-URLs-internally-leads-to-problems-tp2543596p2543596.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



A bug in CryptedUrlWebRequestCodingStrategy

2010-09-15 Thread Bjorn S

Wicket version: 1.4.9 (rolled back due to AJAX problems in later release)

I've detected some odd behaviour with CryptedUrlWebRequestCodingStrategy,
specifically CryptedUrlWebRequestCodingStrategy.DecodedUrlRequest;

When using a QueryStringStrategy for mounting a page and passing certain
specific strings I was getting them back with characters missing. It appears
that CryptedUrlWebRequestCodingStrategy performs double-decoding.


We have a search system which uses + as a means of denoting requirements,
this is what happened;
When entering a search string like car +red it was correctly encoded to
car+%2Bred and passed along.

When decoding I saw that this became car +red and then was decoded again
to car  red [note double space].

I fixed this by extending CryptedUrlWebRequestCodingStrategy, overloading
the decode method and implementing my own copy of DecodedUrlRequest where I
removed the following line from the constructor;
decodedParamReplacement =
WicketURLDecoder.QUERY_INSTANCE.decode(decodedParamReplacement);

This seems to have fixed our problem though I won't guarantee that it hasn't
introduced new ones.

Hope this can get a better resolution.

Regards,
Bjørn Soldal
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/A-bug-in-CryptedUrlWebRequestCodingStrategy-tp2540215p2540215.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