Yes, null is all right.

For every page the javascript checks, whether it's opened in new 
window/tab (therefore the cookie). If so, new pagemap is created, page 
is cloned into the new pagemap and the browser tab/window is redirected 
to the page in new pagemap).

-Matej

Ittay Dror wrote:
> one other question. the original page map name is still 'null'. is this ok?
> 
> Ittay Dror wrote:
>> ok, i did the same magic in my coding strategy and it works. in new tabs 
>> the url now looks like
>> http://localhost/page/SomePage?wicket:bookmarkablePage=wicket-0:com.package.SomePage
>>  
>>
>>
>> can someone explain the mechanism to me? also, why should i take care of 
>> this and not WebRequestCodingStrategy?
>>
>> thanx,
>> ittay
>>
>> Ittay Dror wrote:
>>> well, this is the code in WebRequestCodingStrategy:
>>> public final CharSequence encode(final RequestCycle requestCycle,
>>>             final IRequestTarget requestTarget)
>>>     {
>>>         // first check whether the target was mounted
>>>         CharSequence path = pathForTarget(requestTarget);
>>>         if (path != null)
>>>         {
>>>             CharSequence prefix = urlPrefix(requestCycle);
>>>             final AppendingStringBuffer buffer = new 
>>> AppendingStringBuffer(prefix.length()
>>>                     + path.length());
>>>             buffer.append(prefix);
>>>             buffer.append(path);
>>>             return requestCycle.getOriginalResponse().encodeURL(buffer);
>>>         }
>>>         ....
>>>
>>> the page (target) is indeed mounted, so pathForTarget goes to the 
>>> encoding strategy to encode the path. in case the target was not 
>>> mounted, it would have encoded the url itself (in my case, the target 
>>> is IBookmarkablePageRequestTarget)
>>>
>>> the code there is less than trivial, should i copy & paste? can i 
>>> reference it somehow?
>>>
>>>
>>> ittay
>>>
>>>
>>> Matej Knopp wrote:
>>>> Hmm.. The problem with this kind of bugs is that it's very difficult 
>>>> to reproduce.
>>>>
>>>> IMHO The problem is in this line:
>>>> else {document.location.href = 
>>>> '/page/SomePage;jsessionid=E43E09C7B61190F3C8C5E98CB988F21F?';}
>>>>
>>>> The url should contain pagemap name (something like wicket-1).
>>>>
>>>> In wicket-1.2 the url is built in PageMapChecker#renderHead 
>>>> (WebPage.java line 388 -
>>>> IBookmarkablePageRequestTarget current = 
>>>> (IBookmarkablePageRequestTarget)target;
>>>> BookmarkablePageRequestTarget redirect = new 
>>>> BookmarkablePageRequestTarget(        
>>>> getSession().createAutoPageMapName(), current.getPageClass(), 
>>>> current.getPageParameters());
>>>> url = cycle.urlFor(redirect);
>>>> )
>>>>
>>>> I wonder why the generated url doesn't contain the pageMap name.
>>>>
>>>> -Matej
>>>>
>>>> Ittay Dror wrote:
>>>>> further investigation shows that for IE and openning new windows, it 
>>>>> works fine - a PageMap instance is created, and the page loads fine.
>>>>>
>>>>> i've also started firefox with a new profile (no extensions), to 
>>>>> make sure it's not extension related, and no, it happens there also, 
>>>>> and also when i open a new window instead of new tab. it seems to be 
>>>>> related to differences in cookie (session) handling between firefox 
>>>>> and IE.
>>>>> ittay
>>>>>
>>>>> Ittay Dror wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I'm using firefox. when i duplicate a tab, the tab reloads in an 
>>>>>> infinite loop.
>>>>>>
>>>>>> this is the reason:
>>>>>> <script type="text/javascript"><!--//--><![CDATA[//><!--
>>>>>> var pagemapcookie = getWicketCookie('pm-nullwicket');
>>>>>> if(!pagemapcookie && pagemapcookie != 
>>>>>> '1'){setWicketCookie('pm-nullwicket',1);}
>>>>>> else {document.location.href = 
>>>>>> '/page/SomePage;jsessionid=E43E09C7B61190F3C8C5E98CB988F21F?';}
>>>>>>
>>>>>> //--><!]]></script>
>>>>>>
>>>>>> </head>
>>>>>> <body onunload="deleteWicketCookie('pm-nullwicket');">
>>>>>>
>>>>>>  
>>>>>> what happens is that the pagemapcookie is there when the page is 
>>>>>> rendered, because the previous page was not unloaded, so the 
>>>>>> document's href is changed to itself. of course, when the page 
>>>>>> loads, the cookie is still 1, so the loop continues. the same will 
>>>>>> happen if i just open a new tab and load the same url.
>>>>>>
>>>>>> what gives?
>>>>>>
>>>>>>
>>>>>> also, the code that writes this script is WebPage.PageMapChecker 
>>>>>> the comment in the code is:
>>>>>> /**
>>>>>>      * Tries to determine whether this page was opened in a new 
>>>>>> window or tab.
>>>>>>      * If it is (and this checker were able to recognize that), a 
>>>>>> new page map
>>>>>>      * is created for this page instance, so that it will start 
>>>>>> using it's own
>>>>>>      * history in sync with the browser window or tab.
>>>>>>      */
>>>>>>
>>>>>> i've tried to debug this, but it doesn't look like a new PageMap is 
>>>>>> created (i don't use it, so the PageMap instance is the default 
>>>>>> one). so it seems i *don't* get a history per tab.
>>>>>> can/should i remove the AutomaticMultiWindowSupport setting?
>>>>>> thanx,
>>>>>> ittay
>>>>
>>>> _______________________________________________
>>>> Wicket-user mailing list
>>>> Wicket-user@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>>>
>>>
>>
> 
> 



_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to