ahh
why are we doing this:

public boolean matches(IRequestTarget requestTarget)
    {
        if (requestTarget instanceof IBookmarkablePageRequestTarget)
        {
            IBookmarkablePageRequestTarget target = (IBookmarkablePageRequestTarget)requestTarget;
            if (bookmarkablePageClass.equals(target.getPageClass()))
            {
                if (this.pageMapName == null)
                {
                    return target.getPageMapName() == null;
                }
                else
                {
                    return this.pageMapName.equals(target.getPageMapName());
                }
            }
        }
        return false;
    }

why oh why are we testing here if it matches a specific pagemap.?
i think i will make this :

public boolean matches(IRequestTarget requestTarget)
    {
        if (requestTarget instanceof IBookmarkablePageRequestTarget)
        {
            IBookmarkablePageRequestTarget target = (IBookmarkablePageRequestTarget)requestTarget;
            if (bookmarkablePageClass.equals(target.getPageClass()))
            {
                if ( this.pageMapName == null)
                {
                    return true;  // If not pagemap is specified for this Strategy then all pagemaps map...
                }
                else
                {
                    return this.pageMapName.equals(target.getPageMapName());
                }
            }
        }
        return false;
    }


On 4/16/06, Johan Compagner <[EMAIL PROTECTED]> wrote:
I do render the the cookie _javascript_ now but as i said it will not help much for
normal homepage access. Because then there are no cookies yet.
What we could do yes is a check if it is the first time then do the cookies way
anyway. So that the homepage does set the cookie variable.

i change the if in this:

if ( (cookies == null && accessStack.size() > initialAccessStackSize) || body == null)

so if cookies == null and the accessStack is already greater then what the initial can be. then
it will fall into the old browser history way.
If that is not the case. Then it now always falls into the cookies way.
So also if the accessStack.size() <= initialAccessStackSzie ..

With the current code in svn all urls should be escaped. Because now we all go through the orignal response
and never through the current response. Will test this a bit more.

about mounting, i thought that it would generate a mount url when doing this:


IBookmarkablePageRequestTarget current = (IBookmarkablePageRequestTarget)target;
                BookmarkablePageRequestTarget redirect = new BookmarkablePageRequestTarget(
                        getSession().createAutoPageMapName(), current.getPageClass(), current
                                .getPageParameters());
                url = "">
then it should generate a mount url instead of what you see.
pagemap should just be a parameters like /wicket:pagemap/XXXX

johan



On 4/16/06, Matej Knopp <[EMAIL PROTECTED]> wrote:
But there is a difference in the way it behaves with and without the
empty-pagemap-check.

Say the check is there, and the _javascript_ is not rendered for the first
time page is displayed. You open a link on that page in new tab and the
new tab will be in the same pagemap. Therefore I suggest to always
render the cookie _javascript_.

I checked it with today's svn version, and the URL was _not_ escaped. I
mean the url that goes to the rendered _javascript_.


Btw, wouldn't there be a way to support mounted urls also with wicket
created pagemaps?

Currently, i mount a page on /foo/bar and if I open the page in new tab,
it's no longer /foo/bar, it's bookmarkablePage= org.foo.Bar instaead.

Something like /foo/bar/p1/v1/p2/v2;wicket-pagemap=wicket-0  would be nice.

-Matej

Johan Compagner wrote:
> Don't think this will do much. because for the first page render (the
> homepage)
> there are no cookies set yet. So it always then still does the check for
> the initialpage.
> But i guess if somebody in the webapp has disk cookies set we could use
> the cookie
> pagemap check sooner.
>
> about the url encodig. I changed all code in the core of wicket to use
> RequestCycle.getOriginalResponse()
> instead of using the current response. So that the url encoding is
> always done on the servlet response.
>
> wil namespace the _javascript_ functions.
>
> johan
>
>
>
> On 4/16/06, *Matej Knopp* < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:
>
>     Hi,
>
>     It seems to work :)
>
>     I've just made some minor tweaks (code below). One more thing.
>     StringResponse still doesn't encode URLs correctly. String response is
>     the one responsible for rendering head. So in current state, opening
>     link in new tab without cookies leads to session expiration :(
>
>     Now the code. I change it to render the cookies _javascript_ even if
>     there's no page in page map. This is safe and leads to better behavior.
>
>     -Matej
>
>                     public final void renderHead(final Response response)
>                     {
>                             final WebRequestCycle cycle =
>     (WebRequestCycle)getRequestCycle();
>                             final IRequestTarget target =
>     cycle.getRequestTarget();
>
>                             int initialAccessStackSize = 0;
>                             if
>     (getApplication().getRequestCycleSettings().getRenderStrategy() ==
>     IRequestCycleSettings.REDIRECT_TO_RENDER
>                                             && target instanceof
>     RedirectPageRequestTarget)
>                             {
>                                     initialAccessStackSize = 1;
>                             }
>
>                             // Here is our trickery to detect whether
>     the current request was
>                             // made in a new window/ tab, in which case
>     it should go in a
>                             // different page map so that we don't
>     intermangle the history of
>                             // those windows
>                             final ArrayListStack accessStack =
>     getPageMap().getAccessStack();
>
>
>     //---------------------------------------------------------------------------
>
>                             // it's no longer necessary to have this
>     check here. Cookies related
>                             // _javascript_ can be rendered even when
>     there's no page in pagemap
>                             if (true || accessStack.size () >
>     initialAccessStackSize)
>                             {
>                                     CharSequence url = "">>                                     if (target instanceof
>     IBookmarkablePageRequestTarget)
>                                     {
>                                             IBookmarkablePageRequestTarget
>     current =
>     (IBookmarkablePageRequestTarget)target;
>                                             BookmarkablePageRequestTarget
>     redirect = new
>     BookmarkablePageRequestTarget(
>                                                             getSession().createAutoPageMapName(),
>     current.getPageClass(), current
>                                                                             .getPageParameters());
>
>                                             url = "">>                                     }
>                                     else
>                                     {
>                                             url = "">>     INewBrowserWindowListener.INTERFACE);
>                                     }
>                                     final BodyContainer body =
>     getBodyContainer();
>                                     final Cookie[] cookies =
>     cycle.getWebRequest ().getCookies();
>
>                                     //---------------------------------
>                                     // put the check here.
>                                     if ((accessStack.size () >
>     initialAccessStackSize && cookies == null)
>     ||  body == null)
>                                     {
>                                             // If the browser does not
>     support cookies, we try to work
>                                             // with the history
>
>     ...
>
>     Johan Compagner wrote:
>      > Hi
>      >
>      > Can somebody look if it works for him on their browser?
>      >
>      > I changed the new window detection for a pagemap by setting in
>      > _javascript_ cookies (with the pagemap name as cookie name)
>      >
>      > now on a page load we set a cookie and on a body.onUnLoad we
>     delete the
>      > cookie again.
>      >
>      > So when the page is still there and another page is loaded in a new
>      > window or tab. He first looks for the cookie
>      > and it will see that it is there and then does redirect to
>     another pagemap.
>      >
>      > It will only do this if a cookie can be set (if the current
>     request has
>      > cookies) else it will do the previous check.
>      >
>      > The correct working of this behaviour more or less depends on one
>     thing.
>      > That body.onUnLoad does get executed.
>      > (and cookies must be able to set in _javascript_)
>      >
>      > johan
>      >
>
>
>
>     -------------------------------------------------------
>     This SF.Net email is sponsored by xPML, a groundbreaking scripting
>     language
>     that extends applications into web and mobile media. Attend the live
>     webcast
>     and join the prime developer group breaking into this new coding
>     territory!
>     http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
>     <http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 >
>     _______________________________________________
>     Wicket-develop mailing list
>     Wicket-develop@lists.sourceforge.net
>     <mailto: Wicket-develop@lists.sourceforge.net>
>     https://lists.sourceforge.net/lists/listinfo/wicket-develop
>
>



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Wicket-develop mailing list
Wicket-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-develop


Reply via email to