Nice one. Cheers for your explanations. I am getting there slowly.
On 9 Oct 2007, at 14:25, Matej Knopp wrote:
Hi, see the response below
On 10/9/07, John Patterson <[EMAIL PROTECTED]> wrote:
Hi,
As I am figuring out how to create my own IRequestCodingStrategy I
have come across a few things which seem be suspicious IMHO. I could
be wrong with all of them but I thought I should bring them up...
These are all in WebRequestCodingStrategy
This code...
public final RequestParameters decode(final Request request)
{
parameters.setPageMapName
(WebRequestCodingStrategy.decodePageMapName(request
.getParameter(PAGEMAP)));
}
... calls RequestParameters ...
public void setPageMapName(String pageMapName)
{
// this should be done in coding strategies, but
its here as a
// precaution
this.pageMapName =
WebRequestCodingStrategy.decodePageMapName
(pageMapName);
}
seems to decode the name twice. It also seems to be getting set
again here ...
Yeah, looks that way, the decoding should be only done in setPageMap
name, good catch, although it doesn't really changes the behavior.
public static void addInterfaceParameters(final String
interfaceParameter,
final RequestParameters parameters)
{
...
// Set pagemap name
final String pageMapName = pathComponents[0];
parameters.setPageMapName(pageMapName.length() == 0 ?
PageMap.DEFAULT_NAME : pageMapName);
...
}
This method seems to have old Javadoc stating that
/**
* Adds bookmarkable page related parameters (page alias and
optionally page parameters). Any
* bookmarkable page alias mount will override this
method; hence if
a mount is found, this
* method will not be called.
protected void addBookmarkablePageParameters(final Request
request,
but it doesn't seem to do this any more and I think it is called
_before_ mounts are tried
That might be true, but for mounted pages the method doesn't do
anything, as there is no wicket:bookmarkablePage parameter inside URL.
The interface IRequestTargetMountsInfo contains one method which is
not referenced anywhere in Wicket (maybe in wicketstuff?)
Probably a left over from prior refactoring.
It seems that the concept of handlers for coding URL's like is
great but I wish it was used at the top level and not just for
mounted pages.
Well, nothing should prevent you from writing your own strategy and in
that strategy you can handle the mounted page as you wish. Just keep
in mind there are many kinds of URLs, and your strategy has to support
those.
Anyway, we are aware that the URL coding/decoding is far from perfect
and some parts are rather cumbersome. So it should be subject of a
major refactor in the next release.
-Matej
What is bookmarkablePageClass doing in RequestParameters? This seems
out of place considering it is passed in as an argument to
IRequestTargetUrlCodingStrategy which has the responsibility of
choosing and creating the type of target.
Again, URL coding strategy is only for mounted pages. There are
bookmarkable URLS even without mounted pages, and that is handled by
WebRequestCodingStrategy.
Maybe a good approach would be to iterate through all registered
handlers for each request until one can handle it. The default
handling done in WebRequestCodingStrategy could simply be the last
handler in the chain. Resources and mounts could be first by default
and users (like me) could add their own handlers.
Anyway... just some thoughts while I am knee deep in the internals of
this area.
John.
On 9 Oct 2007, at 01:24, Matej Knopp wrote:
IIRC WebRequestCodingStrategy is used for non-mounted pages only and
it delegates the encoding/decoding for mounted pages to
IRequestTargetUrlCodingStrategy.
-Matej
On 10/9/07, John Patterson <[EMAIL PROTECTED]> wrote:
Hi,
I want to build a custom url encoder fro bookmarkable pages and
have
been looking at BookmarkablePageRequestTargetUrlCodingStrategy.
Can
someone quickly contrast the responsibilities of
IRequestTargetUrlCodingStrategy and WebRequestCodingStrategy.
From a
quick look it seems like they duplicate some of the encoding/
decoding
functionality.
If I want to change the way URL's are translated for every
bookmarkable page (including which page to create) should I
override
WebRequestCodingStrategy.encode()/decode()?
Cheers,
John
-------------------------------------------------------------------
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]