On Wed, Jul 27, 2016 at 12:38 PM, Damianos Metallidis <[email protected]
> wrote:

> Hello,
>
> Thanks for the response as this helped a lot to understand.
>
> Now i am doing the following,
>
> On the server-side i have put the below code which gets an
> ajaxRequestTarget after the page is loaded:
>
> this.add(new AjaxEventBehavior("load") {
>             @Override
>             protected void onEvent(AjaxRequestTarget ajaxRequestTarget) {
>                 StringValue connectEnd =
> ajaxRequestTarget.getPageParameters().get("window.performance.timing.connectEnd");
>                 System.out.println("ConnectEnd equals to : " +
> connectEnd.toString());
>             }
>         });
>
> But the string i get is still null. Should i also pass them somehow
> through my .html page?
>

Yes.
You should send them with something like:
https://github.com/apache/wicket/blob/e79fcb8787187108e8a16b2ae9ababecfcc76cf2/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxNewWindowNotifyingBehavior.java#L97-L98


> Any help appreciated :)
>
> Regards,
> Damian
>
> On 7/27/2016 10:23 AM, Martin Grigorov wrote:
>
>> Hi,
>>
>> Here is the order:
>> - Wicket generates the HTML at the server side (onConfigure(),
>> onBeforeRender(), onRender(), onAfterRender())
>> - Wicket writes the HTML to the HTTP response
>> - the HTML is rendered by the browser (i.e. the timings happen at that
>> phase!)
>>
>> To get the values at the server you need to add AjaxEventBehavior("load")
>> to your page, so that it fires when the browser has fully rendered/loaded
>> the HTML. This behavior should collect the data you need and send it to
>> the
>> server.
>>
>>
>> https://github.com/apache/wicket/blob/e79fcb8787187108e8a16b2ae9ababecfcc76cf2/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxNewWindowNotifyingBehavior.java
>> is doing something similar. It reads 'window.name' and sends it to the
>> server to notify the application when the same page instance is loaded in
>> more than one tabs in the browser. You can use it as inspiration.
>>
>> Martin Grigorov
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>>
>> On Tue, Jul 26, 2016 at 9:38 PM, Damianos Metallidis <
>> [email protected]>
>> wrote:
>>
>> Hello to all,
>>> I have used the library of timing.js(
>>> https://github.com/addyosmani/timing.js/) and it's very handy. I want to
>>> ask you although one question.
>>>
>>> I am running the above client library the client side of a localhost
>>> webapp. The thing is that i want to get the these javascript values on my
>>> server-side code. I am using wicket in the front-end.
>>> Is it possible to retrieve them? For example to get the
>>> /window.performance.timing.connectEnd
>>>
>>> /My problem here is that the page should be rendered to have the values
>>> of
>>> timing available.
>>> Perhaps any suggestion?
>>> I have used the onAfterRender() method but it returns me null:
>>>
>>>   @Override
>>>      protected void onAfterRenderChildren()
>>>      {
>>>          super.onAfterRenderChildren();
>>> //        StringValue ce =
>>>
>>> RequestCycle.get().getRequest().getRequestParameters().getParameterValue("window.performance.timing.connectEnd");
>>>
>>>         System.out.println(ce .toString()); // it's null...
>>> }
>>>
>>> My best regards,
>>> Damian
>>>
>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to