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 ...
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
The interface IRequestTargetMountsInfo contains one method which is
not referenced anywhere in Wicket (maybe in wicketstuff?)
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.
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.
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]