You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Matteo Alessandroni <sk...@apache.org> on 2019/02/21 08:54:40 UTC

WebSocketRequestHandler object not executing javascript code

Hi,

we have a logic where a websocket message is sent from an "onEvent()" 
method [1] and catched in a WebSocketBehavior class [2].
Then, a call to a js method "addEndpoint()"[3] must be executed.
Our problem is that the js code "addEndpoint(...)" inside 
"handler.appendJavaScript(...)" [4] is not executed, so the code 
correctly reaches that switch case but it's like the 
"appendJavaScript(...)" is not working.

On our application v2.0.x that code works and it uses Wicket 7.x, while 
the newer v2.1.x  uses Wicket 8.x and it does not work.

Could you please give us an hint of this? Is there anything we are 
missing to make it work for Wicket 8.x?

Thank you!


[1] 
https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
[2] 
https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L153-L157
[3] 
https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/resources/META-INF/resources/js/topology.js#L269-L280
[4] 
https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L154

-- 

Dott. Matteo Alessandroni

Software Engineer @ Tirasa S.r.l.

Viale Vittoria Colonna, 97 - 65127 Pescara
Tel +39 0859116307 / FAX +39 0859111173

http://www.tirasa.net

Apache Syncope PMC Member
http://people.apache.org/phonebook.html?uid=skylark17 
<http://people.apache.org/phonebook.html?uid=skylark17>

Tirasa S.r.l. <http://www.tirasa.net>

Re: WebSocketRequestHandler object not executing javascript code

Posted by Matteo Alessandroni <sk...@apache.org>.
On 01/03/19 20:09, Sven Meier wrote:
> Hi,
>
> you're using a CsrfPreventionRequestCycleListener that prevents 
> WebSocket pushs to the client because there's no referrer set.
>
> You should use a WebSocketAwareCsrfPreventionRequestCycleListener 
> instead.
>
> Have fun
> Sven

Hi Sven,

Your solution works great!
Thank you so much for the help!

>
>
> BTW credentials are admin/passwordd

Yes you are right, it was a typo :)!

Have a good day!
Matteo

>
>
> Am 28.02.19 um 16:27 schrieb Matteo Alessandroni:
>>
>>
>> On 28/02/19 15:11, Martin Grigorov wrote:
>>> Hi,
>>>
>>> I've explained you earlier where to look at.
>>> WebSocketRequestHandler#respond() is not called for some reason.
>>> It is scheduled in AbstractWebSocketProcessor with
>>> requestCycle#scheduleAfterCurrent() but it seems later another
>>> IRequestHandler is scheduled and replaced it.
>>>
>>> If you can reproduce in a mini application I would be happy to debug 
>>> it.
>>>
>>> On Thu, Feb 28, 2019 at 3:51 PM Matteo Alessandroni 
>>> <sk...@apache.org>
>>> wrote:
>>
>> Hi,
>>
>> our application is open source and you can easily reproduce the issue.
>> If you are available to debug it, here are the simple steps to start 
>> Syncope and reproduce the case:
>>
>>  * Download source code from [1] e go to branch 2_1_X;
>>  * Build and run it by running:
>>    mvn -PskipTests,all && cd fit/enduser-reference && mvn -Pdebug;
>>  * Go to http://localhost:9080/syncope-console/, login with "admin /
>>    admin" and click on "Topology" from the left menu;
>>  * Click on the first node from the bottom and select "Add new 
>> connector";
>>  * Fill the required fields (with "*") with random values, select
>>    "net.tirasa.connid.bundles.soap" in the "Bundle *" dropdown and
>>    click "Next";
>>  * Insert random values for the "Service Endpoint *" and "Service name
>>    *" fields, click "Next" again, then click "Finish". A connector node
>>    is now created;
>>
>> The issue is that the node should be visible as soon as the wizard 
>> disappears (after finish), but, instead, it's not until you refresh 
>> the page (e.g. click on "Topology" again).
>> The notable parts in the code are on [2] and [3] (as mentioned before).
>>
>> I really appreciate your help!
>> Thank you!
>>
>> [1] https://github.com/apache/syncope/tree/2_1_X
>>
>> [2] 
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
>>
>> [3] 
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L153-L158
>>
>>
>>
>>>
>>>>
>>>> On 22/02/19 12:55, Matteo Alessandroni wrote:
>>>>>
>>>>> On 22/02/19 12:46, Martin Grigorov wrote:
>>>>>> On Fri, Feb 22, 2019 at 1:40 PM Matteo Alessandroni
>>>>>> <sk...@apache.org>
>>>>>> wrote:
>>>>>>
>>>>>>> On 22/02/19 12:28, Matteo Alessandroni wrote:
>>>>>>>> On 22/02/19 10:31, Martin Grigorov wrote:
>>>>>>>>> On Fri, Feb 22, 2019 at 10:50 AM Matteo Alessandroni
>>>>>>>>> <sk...@apache.org>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> On 21/02/19 18:50, Martin Grigorov wrote:
>>>>>>>>>>> On Thu, Feb 21, 2019, 18:29 Matteo Alessandroni
>>>>>>>>>>> <skylark17@apache.org
>>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> On 21/02/19 16:43, Martin Grigorov wrote:
>>>>>>>>>>>>> On Thu, Feb 21, 2019 at 5:35 PM Matteo Alessandroni <
>>>>>>>>>>>> skylark17@apache.org>
>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>> On 21/02/19 16:30, Martin Grigorov wrote:
>>>>>>>>>>>>>>> On Thu, Feb 21, 2019 at 5:24 PM Matteo Alessandroni <
>>>>>>>>>>>>>> skylark17@apache.org>
>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> On 21/02/19 16:07, Martin Grigorov wrote:
>>>>>>>>>>>>>>>>> On Thu, Feb 21, 2019 at 4:41 PM Matteo Alessandroni <
>>>>>>>>>>>>>>>> skylark17@apache.org>
>>>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> On 21/02/19 12:14, Martin Grigorov wrote:
>>>>>>>>>>>>>>>>>>> On Thu, Feb 21, 2019 at 12:11 PM Matteo Alessandroni <
>>>>>>>>>>>>>>>>>>> matteo.alessandroni@tirasa.net> wrote:
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> On 21/02/19 11:05, Martin Grigorov wrote:
>>>>>>>>>>>>>>>>>>>>> When the WebSocket connection is established (maybe
>>>>>>>>>>>>>>>>>>>>> when the
>>>>>>>>>> page
>>>>>>>>>>>>>> is
>>>>>>>>>>>>>>>>>>>>> loaded) you should see an entry in the Network tab.
>>>>>>>>>>>>>>>>>>>>> If you select this entry then on the right-side you
>>>>>>>>>>>>>>>>>>>>> should see
>>>>>>>>>>>> any
>>>>>>>>>>>>>> WS
>>>>>>>>>>>>>>>>>>>>> messages to/from the server.
>>>>>>>>>>>>>>>>>>>> Yes I know how about WS debugging, but I do not see 
>>>>>>>>>>>>>>>>>>>> any WS
>>>>>>>>>> request
>>>>>>>>>>>>>>>> (with
>>>>>>>>>>>>>>>>>>>> WS devtool filter and without it).
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Maybe this is the problem.
>>>>>>>>>>>>>>>>>>> If there is no WebSocket response at all then there 
>>>>>>>>>>>>>>>>>>> is no
>>>>>>>>>>>>>>>>>>> way the
>>>>>>>>>>>> JS
>>>>>>>>>>>>>>>> code
>>>>>>>>>>>>>>>>>>> to be executed.
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> But since your WebSocketBehavior callback method is
>>>>>>>>>>>>>>>>>>> executed then
>>>>>>>>>>>>>> there
>>>>>>>>>>>>>>>>>>> must be an established WebSocket connection.
>>>>>>>>>>>>>>>>>>> I have no idea what goes wrong.
>>>>>>>>>>>>>>>>>> It is strange because in our application version that 
>>>>>>>>>>>>>>>>>> uses
>>>>>>>>>>>>>>>>>> Wicket
>>>>>>>>>>>> 7.x
>>>>>>>>>>>>>> I
>>>>>>>>>>>>>>>>>> see no WS requests in DevTools console as well, but the
>>>>>>>>>>>>>>>>>> code is
>>>>>>>>>>>>>>>>>> correctly executed and everything works.
>>>>>>>>>>>>>>>>>> Yes the WebSocket connection seems to be established
>>>>>>>>>>>>>>>>>> anyway in
>>>>>>>>>> both
>>>>>>>>>>>>>> our
>>>>>>>>>>>>>>>>>> versions so with both Wicket 7.x and 8.x, but for some
>>>>>>>>>>>>>>>>>> reason the
>>>>>>>>>>>>>>>>>> "appendJavaScript()" method does not work on the
>>>>>>>>>>>>>>>>>> "WebSocketRequestHandler" object with Wicket 8.x.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Is there anything else we can try to make it work?
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Put a breakpoint at
>>>>>>>>>>>>>>>>>
>>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141 
>>>>
>>>>>>>>>>>>>>>>> and see whether it is called.
>>>>>>>>>>>>>>>>> And another one at
>>>>>>>>>>>>>>>>>
>>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86 
>>>>
>>>>>>>>>>>>>>>>> to see whether the XML response is being written back 
>>>>>>>>>>>>>>>>> to the
>>>>>>>>>> browser
>>>>>>>>>>>> in
>>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>>> WebSocketConnection.
>>>>>>>>>>>>>>>> Thanks!
>>>>>>>>>>>>>>>> Ok the first method [1] was called many times and once 
>>>>>>>>>>>>>>>> was the
>>>>>>>>>>>>>>>> one
>>>>>>>>>> I'm
>>>>>>>>>>>>>>>> interested on where the "script" variable was:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>> "window.Wicket.WebSocket.send('{"kind":"ADD_ENDPOINT","target":"...","source":"...","scope":"..."}');" 
>>>>
>>>>
>>>>>>>
>>>>>>>>>>>>>>>> also the second one [2] was called, but *only once* and
>>>>>>>>>>>>>>>> both the
>>>>>>>>>>>> "text"
>>>>>>>>>>>>>>>> and "binary" variables were null.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> What is the type of "response" variable at
>>>>>>>>>>>>>>>
>>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141 
>>>>
>>>>>>>>>>>>>>> ?
>>>>>>>>>>>>>>> It seems it is not WebSocketResponse
>>>>>>>>>>>>>> Ideed, it's "StringResponse"!
>>>>>>>>>>>>>> And it's content is something like this:
>>>>>>>>>>>>>>
>>>>>>>>>>>>> I didn't expect this!
>>>>>>>>>>>>> Can you please put a breakpoint
>>>>>>>>>>>>> at org.apache.wicket.response.StringResponse#StringResponse()
>>>>>>>>>>>>> (the
>>>>>>>>>>>>> constructor) and see where it is instantiated.
>>>>>>>>>>>>> AjaxRequestHandler uses StringResponse, but
>>>>>>>>>>>>> WebSocketRequestHandler
>>>>>>>>>> does
>>>>>>>>>>>>> not.
>>>>>>>>>>>> I'm not completely sure but it seems that all the times the
>>>>>>>>>>>> application
>>>>>>>>>>>> enters in [1] (including when "script" contains 
>>>>>>>>>>>> "addEnpoint(...)")
>>>>>>>>>>>> and
>>>>>>>>>>>> then the "StringResponse()" constructor is called, the source
>>>>>>>>>>>> is [2].
>>>>>>>>>>>>
>>>>>>>>>>>> [1]
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141 
>>>>
>>>>>>>>>>>> [2]
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestHandler.java#L360 
>>>>
>>>>>>>>>>> It seems WebSocketRequestHandler#respond() is not called at 
>>>>>>>>>>> all.
>>>>>>>>>>> Put a breakpoint in AbstractWebSocketProcessor and see what 
>>>>>>>>>>> happens
>>>>>>>>>> there.
>>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>> ok thanks, I did that and the constructor of
>>>>>>>>>> "AbstractWebSocketProcessor" is never called!
>>>>>>>>>>
>>>>>>>>> The constructor should be called when the WS connection is
>>>>>>>>> established.
>>>>>>>>> I guess you use wicket-native-websocket-javax.
>>>>>>>>> Check org.apache.wicket.protocol.ws.javax.JavaxWebSocketProcessor
>>>> and
>>>>>>>>> its
>>>>>>>>> org.apache.wicket.protocol.ws
>>>>>>> .javax.JavaxWebSocketProcessor.StringMessageHandler
>>>>>>>>> onMessage() method is called when the client sends something 
>>>>>>>>> to the
>>>>>>>>> server.
>>>>>>>>> onMessage() delegates
>>>>>>>>> to
>>>>>>>>> org.apache.wicket.protocol.ws
>>>>>>> .api.AbstractWebSocketProcessor#broadcastMessage()
>>>>>>>>> where the processing happens, i.e. 
>>>>>>>>> WebSocketBehavior#onMessage() is
>>>>>>>>> called.
>>>>>>>> Yes we use "wicket-native-websocket-javax" [1].
>>>>>>>> What I have just done is putting a breackpoint in both that method
>>>>>>>> from
>>>>>>>>
>>>> "org.apache.wicket.protocol.ws.javax.JavaxWebSocketProcessor#StringMessageHandler 
>>>>
>>>>
>>>>>>>> onMessage()" and
>>>>>>>>
>>>> "org.apache.wicket.protocol.ws.api.AbstractWebSocketProcessor#broadcastMessage()", 
>>>>
>>>>
>>>>>>>
>>>>>>>> but it does *not* enter there either.
>>>>>>>>
>>>>>>>> So at that point I have tried to start v2.0.x with Wicket 7.x and
>>>>>>>> tried to debug the same way, the result is that it enters in 
>>>>>>>> [2] only.
>>>>>>>>
>>>>>>>>
>>>>>>>> [1]
>>>>>>>>
>>>> https://github.com/apache/syncope/blob/2_1_X/client/console/pom.xml#L83 
>>>>
>>>>>>>> [2]
>>>>>>>>
>>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/JavaxWebSocketProcessor.java#L65 
>>>>
>>>>>>>
>>>>>>> Sorry I correct myself, I tried again with 2.1.x (Wicket 8.x) 
>>>>>>> and it
>>>>>>> entered in [1] and [2].
>>>>>>>
>>>>>>> [1]
>>>>>>>
>>>>>>>
>>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/JavaxWebSocketProcessor.java#L65 
>>>>
>>>>>>>
>>>>>>> [2]
>>>>>>>
>>>>>>>
>>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketProcessor.java#L213 
>>>>
>>>>>> Once the debugger is here set another breakpoint at
>>>>>>
>>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java#L840 
>>>>
>>>>>> and
>>>>>>
>>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java#L871 
>>>>
>>>>>>
>>>>>> it seems something removes WebSocketRequestHandler from the 
>>>>>> pipeline and
>>>>>> that's why its #respond() method is not executed.
>>>>> Ok, it enters just a couple of times in [1] right after [2] and [3].
>>>>>
>>>>> [1]
>>>>>
>>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java#L840 
>>>>
>>>>> [2]
>>>>>
>>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/JavaxWebSocketProcessor.java#L65 
>>>>
>>>>> [3]
>>>>>
>>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketProcessor.java#L213 
>>>>
>>>>
>>>>
>>>> Hi Grigorov,
>>>>
>>>> is there anything else I can do for this?
>>>> Is there a chance you reproduced it?
>>>>
>>>> Thanks!
>>>>
>>>>
>>>>>>>>>>>>>> <?xml version="1.0" 
>>>>>>>>>>>>>> encoding="UTF-8"?><ajax-response><component
>>>>>>>>>>>>>> id="id178" ><![CDATA[<span id="id178">
>>>>>>>>>>>>>> <div class="wizard-form">
>>>>>>>>>>>>>> <div id="id204">
>>>>>>>>>>>>>> <div class="wizard-overview">
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> </div>
>>>>>>>>>>>>>> <div class="wizard-header">
>>>>>>>>>>>>>> <div>
>>>>>>>>>>>>>> <div>
>>>>>>>>>>>>>> <div class="wizard-step-title">
>>>>>>>>>>>>>> <div></div>
>>>>>>>>>>>>>> </div>
>>>>>>>>>>>>>> <div class="wizard-step-summary">
>>>>>>>>>>>>>> <div></div>
>>>>>>>>>>>>>> </div>
>>>>>>>>>>>>>> </div>
>>>>>>>>>>>>>> </div>
>>>>>>>>>>>>>> </div>
>>>>>>>>>>>>>> <div class="wizard-view">
>>>>>>>>>>>>>> <div id="id207">
>>>>>>>>>>>>>> <span id="id226">
>>>>>>>>>>>>>> <span id="id227">
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> ...
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> [1]
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141 
>>>>
>>>>>>>>>>>>>>>> [2]
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86 
>>>>
>>>>>>>>>>>>>>>>>> Thanks
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> What is the type of resourceCreateEvent.getTarget() ?
>>>>>>>>>>>>>>>>>>>>> Is it WebSocketRequestHandler or AjaxRequestHandler ?
>>>>>>>>>>>>>>>>>>>> "resourceCreateEvent.getTarget()"type is
>>>>>>>>>>>>>>>>>>>> "AjaxRequestHandler".
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> [1]
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>
>>>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609 
>>>>
>>>>>>>>>>>>>>>>>>>>>> On 21/02/19 10:01, Martin Grigorov wrote:
>>>>>>>>>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>> Check the browser's Dev Tools' console for any
>>>>>>>>>>>>>>>>>>>>>>> JavaScript
>>>>>>>>>>>> errors.
>>>>>>>>>>>>>>>>>>>>>>> If there are no errors then check in the DevTools
>>>>>>>>>>>>>>>>>>>>>>> Network tab
>>>>>>>>>>>>>>>> whether
>>>>>>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>>>>>>>>> WebSocket response frame contains the JS code in 
>>>>>>>>>>>>>>>>>>>>>>> its
>>>>>>>>>>>>>>>>>>>>>>> body. It
>>>>>>>>>>>>>> must
>>>>>>>>>>>>>>>> be
>>>>>>>>>>>>>>>>>>>>>>> inside <execution> XML element. If it is not there
>>>>>>>>>>>>>>>>>>>>>>> at all
>>>>>>>>>> then
>>>>>>>>>>>> it
>>>>>>>>>>>>>>>>>> must
>>>>>>>>>>>>>>>>>>>> be
>>>>>>>>>>>>>>>>>>>>>>> something on the server side.
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>> On Thu, Feb 21, 2019 at 10:54 AM Matteo 
>>>>>>>>>>>>>>>>>>>>>>> Alessandroni <
>>>>>>>>>>>>>>>>>>>>>> skylark17@apache.org>
>>>>>>>>>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>> we have a logic where a websocket message is sent
>>>>>>>>>>>>>>>>>>>>>>>> from an
>>>>>>>>>>>>>>>>>> "onEvent()"
>>>>>>>>>>>>>>>>>>>>>>>> method [1] and catched in a WebSocketBehavior 
>>>>>>>>>>>>>>>>>>>>>>>> class
>>>>>>>>>>>>>>>>>>>>>>>> [2].
>>>>>>>>>>>>>>>>>>>>>>>> Then, a call to a js method "addEndpoint()"[3] 
>>>>>>>>>>>>>>>>>>>>>>>> must be
>>>>>>>>>>>> executed.
>>>>>>>>>>>>>>>>>>>>>>>> Our problem is that the js code "addEndpoint(...)"
>>>>>>>>>>>>>>>>>>>>>>>> inside
>>>>>>>>>>>>>>>>>>>>>>>> "handler.appendJavaScript(...)" [4] is not 
>>>>>>>>>>>>>>>>>>>>>>>> executed,
>>>>>>>>>>>>>>>>>>>>>>>> so the
>>>>>>>>>>>> code
>>>>>>>>>>>>>>>>>>>>>>>> correctly reaches that switch case but it's 
>>>>>>>>>>>>>>>>>>>>>>>> like the
>>>>>>>>>>>>>>>>>>>>>>>> "appendJavaScript(...)" is not working.
>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>> On our application v2.0.x that code works and 
>>>>>>>>>>>>>>>>>>>>>>>> it uses
>>>>>>>>>>>>>>>>>>>>>>>> Wicket
>>>>>>>>>>>>>> 7.x,
>>>>>>>>>>>>>>>>>>>> while
>>>>>>>>>>>>>>>>>>>>>>>> the newer v2.1.x  uses Wicket 8.x and it does not
>>>>>>>>>>>>>>>>>>>>>>>> work.
>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>> Could you please give us an hint of this? Is there
>>>>>>>>>>>>>>>>>>>>>>>> anything
>>>>>>>>>> we
>>>>>>>>>>>>>> are
>>>>>>>>>>>>>>>>>>>>>>>> missing to make it work for Wicket 8.x?
>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>> Thank you!
>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>> [1]
>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>
>>>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609 
>>>>
>>>>>>>>>>>>>>>>>>>>>>>> [2]
>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>
>>>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L153-L157 
>>>>
>>>>>>>>>>>>>>>>>>>>>>>> [3]
>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>
>>>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/resources/META-INF/resources/js/topology.js#L269-L280 
>>>>
>>>>>>>>>>>>>>>>>>>>>>>> [4]
>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>
>>>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L154 
>>>>
>>>>>>>>>>>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17 
>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>> <
>>>> http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17 
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17> 
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17> 
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>>>
>>>>>>>>>>>> -- 
>>>>>>>>>>>>
>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>
>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>
>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>
>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>
>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>>
>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>
>>>>>>>>>> -- 
>>>>>>>>>>
>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>
>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>
>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>
>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>
>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>
>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>
>>>>>>> -- 
>>>>>>>
>>>>>>> Dott. Matteo Alessandroni
>>>>>>>
>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>
>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>
>>>>>>> http://www.tirasa.net
>>>>>>>
>>>>>>> Apache Syncope PMC Member
>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>
>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>
>>>> -- 
>>>>
>>>> Dott. Matteo Alessandroni
>>>>
>>>> Software Engineer @ Tirasa S.r.l.
>>>>
>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>
>>>> http://www.tirasa.net
>>>>
>>>> Apache Syncope PMC Member
>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>
>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>

-- 

Dott. Matteo Alessandroni

Software Engineer @ Tirasa S.r.l.

Viale Vittoria Colonna, 97 - 65127 Pescara
Tel +39 0859116307 / FAX +39 0859111173

http://www.tirasa.net

Apache Syncope PMC Member
http://people.apache.org/phonebook.html?uid=skylark17 
<http://people.apache.org/phonebook.html?uid=skylark17>

Tirasa S.r.l. <http://www.tirasa.net>

Re: WebSocketRequestHandler object not executing javascript code

Posted by Sven Meier <sv...@meiers.net>.
Hi,

you're using a CsrfPreventionRequestCycleListener that prevents 
WebSocket pushs to the client because there's no referrer set.

You should use a WebSocketAwareCsrfPreventionRequestCycleListener instead.

Have fun
Sven


BTW credentials are admin/passwordd


Am 28.02.19 um 16:27 schrieb Matteo Alessandroni:
>
>
> On 28/02/19 15:11, Martin Grigorov wrote:
>> Hi,
>>
>> I've explained you earlier where to look at.
>> WebSocketRequestHandler#respond() is not called for some reason.
>> It is scheduled in AbstractWebSocketProcessor with
>> requestCycle#scheduleAfterCurrent() but it seems later another
>> IRequestHandler is scheduled and replaced it.
>>
>> If you can reproduce in a mini application I would be happy to debug it.
>>
>> On Thu, Feb 28, 2019 at 3:51 PM Matteo Alessandroni 
>> <sk...@apache.org>
>> wrote:
>
> Hi,
>
> our application is open source and you can easily reproduce the issue.
> If you are available to debug it, here are the simple steps to start 
> Syncope and reproduce the case:
>
>  * Download source code from [1] e go to branch 2_1_X;
>  * Build and run it by running:
>    mvn -PskipTests,all && cd fit/enduser-reference && mvn -Pdebug;
>  * Go to http://localhost:9080/syncope-console/, login with "admin /
>    admin" and click on "Topology" from the left menu;
>  * Click on the first node from the bottom and select "Add new 
> connector";
>  * Fill the required fields (with "*") with random values, select
>    "net.tirasa.connid.bundles.soap" in the "Bundle *" dropdown and
>    click "Next";
>  * Insert random values for the "Service Endpoint *" and "Service name
>    *" fields, click "Next" again, then click "Finish". A connector node
>    is now created;
>
> The issue is that the node should be visible as soon as the wizard 
> disappears (after finish), but, instead, it's not until you refresh 
> the page (e.g. click on "Topology" again).
> The notable parts in the code are on [2] and [3] (as mentioned before).
>
> I really appreciate your help!
> Thank you!
>
> [1] https://github.com/apache/syncope/tree/2_1_X
>
> [2] 
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
>
> [3] 
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L153-L158
>
>
>
>>
>>>
>>> On 22/02/19 12:55, Matteo Alessandroni wrote:
>>>>
>>>> On 22/02/19 12:46, Martin Grigorov wrote:
>>>>> On Fri, Feb 22, 2019 at 1:40 PM Matteo Alessandroni
>>>>> <sk...@apache.org>
>>>>> wrote:
>>>>>
>>>>>> On 22/02/19 12:28, Matteo Alessandroni wrote:
>>>>>>> On 22/02/19 10:31, Martin Grigorov wrote:
>>>>>>>> On Fri, Feb 22, 2019 at 10:50 AM Matteo Alessandroni
>>>>>>>> <sk...@apache.org>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> On 21/02/19 18:50, Martin Grigorov wrote:
>>>>>>>>>> On Thu, Feb 21, 2019, 18:29 Matteo Alessandroni
>>>>>>>>>> <skylark17@apache.org
>>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>>> On 21/02/19 16:43, Martin Grigorov wrote:
>>>>>>>>>>>> On Thu, Feb 21, 2019 at 5:35 PM Matteo Alessandroni <
>>>>>>>>>>> skylark17@apache.org>
>>>>>>>>>>>> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> On 21/02/19 16:30, Martin Grigorov wrote:
>>>>>>>>>>>>>> On Thu, Feb 21, 2019 at 5:24 PM Matteo Alessandroni <
>>>>>>>>>>>>> skylark17@apache.org>
>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On 21/02/19 16:07, Martin Grigorov wrote:
>>>>>>>>>>>>>>>> On Thu, Feb 21, 2019 at 4:41 PM Matteo Alessandroni <
>>>>>>>>>>>>>>> skylark17@apache.org>
>>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> On 21/02/19 12:14, Martin Grigorov wrote:
>>>>>>>>>>>>>>>>>> On Thu, Feb 21, 2019 at 12:11 PM Matteo Alessandroni <
>>>>>>>>>>>>>>>>>> matteo.alessandroni@tirasa.net> wrote:
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> On 21/02/19 11:05, Martin Grigorov wrote:
>>>>>>>>>>>>>>>>>>>> When the WebSocket connection is established (maybe
>>>>>>>>>>>>>>>>>>>> when the
>>>>>>>>> page
>>>>>>>>>>>>> is
>>>>>>>>>>>>>>>>>>>> loaded) you should see an entry in the Network tab.
>>>>>>>>>>>>>>>>>>>> If you select this entry then on the right-side you
>>>>>>>>>>>>>>>>>>>> should see
>>>>>>>>>>> any
>>>>>>>>>>>>> WS
>>>>>>>>>>>>>>>>>>>> messages to/from the server.
>>>>>>>>>>>>>>>>>>> Yes I know how about WS debugging, but I do not see 
>>>>>>>>>>>>>>>>>>> any WS
>>>>>>>>> request
>>>>>>>>>>>>>>> (with
>>>>>>>>>>>>>>>>>>> WS devtool filter and without it).
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Maybe this is the problem.
>>>>>>>>>>>>>>>>>> If there is no WebSocket response at all then there 
>>>>>>>>>>>>>>>>>> is no
>>>>>>>>>>>>>>>>>> way the
>>>>>>>>>>> JS
>>>>>>>>>>>>>>> code
>>>>>>>>>>>>>>>>>> to be executed.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> But since your WebSocketBehavior callback method is
>>>>>>>>>>>>>>>>>> executed then
>>>>>>>>>>>>> there
>>>>>>>>>>>>>>>>>> must be an established WebSocket connection.
>>>>>>>>>>>>>>>>>> I have no idea what goes wrong.
>>>>>>>>>>>>>>>>> It is strange because in our application version that 
>>>>>>>>>>>>>>>>> uses
>>>>>>>>>>>>>>>>> Wicket
>>>>>>>>>>> 7.x
>>>>>>>>>>>>> I
>>>>>>>>>>>>>>>>> see no WS requests in DevTools console as well, but the
>>>>>>>>>>>>>>>>> code is
>>>>>>>>>>>>>>>>> correctly executed and everything works.
>>>>>>>>>>>>>>>>> Yes the WebSocket connection seems to be established
>>>>>>>>>>>>>>>>> anyway in
>>>>>>>>> both
>>>>>>>>>>>>> our
>>>>>>>>>>>>>>>>> versions so with both Wicket 7.x and 8.x, but for some
>>>>>>>>>>>>>>>>> reason the
>>>>>>>>>>>>>>>>> "appendJavaScript()" method does not work on the
>>>>>>>>>>>>>>>>> "WebSocketRequestHandler" object with Wicket 8.x.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Is there anything else we can try to make it work?
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Put a breakpoint at
>>>>>>>>>>>>>>>>
>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141 
>>>
>>>>>>>>>>>>>>>> and see whether it is called.
>>>>>>>>>>>>>>>> And another one at
>>>>>>>>>>>>>>>>
>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86 
>>>
>>>>>>>>>>>>>>>> to see whether the XML response is being written back 
>>>>>>>>>>>>>>>> to the
>>>>>>>>> browser
>>>>>>>>>>> in
>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>> WebSocketConnection.
>>>>>>>>>>>>>>> Thanks!
>>>>>>>>>>>>>>> Ok the first method [1] was called many times and once 
>>>>>>>>>>>>>>> was the
>>>>>>>>>>>>>>> one
>>>>>>>>> I'm
>>>>>>>>>>>>>>> interested on where the "script" variable was:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>> "window.Wicket.WebSocket.send('{"kind":"ADD_ENDPOINT","target":"...","source":"...","scope":"..."}');" 
>>>
>>>
>>>>>>
>>>>>>>>>>>>>>> also the second one [2] was called, but *only once* and
>>>>>>>>>>>>>>> both the
>>>>>>>>>>> "text"
>>>>>>>>>>>>>>> and "binary" variables were null.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>> What is the type of "response" variable at
>>>>>>>>>>>>>>
>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141 
>>>
>>>>>>>>>>>>>> ?
>>>>>>>>>>>>>> It seems it is not WebSocketResponse
>>>>>>>>>>>>> Ideed, it's "StringResponse"!
>>>>>>>>>>>>> And it's content is something like this:
>>>>>>>>>>>>>
>>>>>>>>>>>> I didn't expect this!
>>>>>>>>>>>> Can you please put a breakpoint
>>>>>>>>>>>> at org.apache.wicket.response.StringResponse#StringResponse()
>>>>>>>>>>>> (the
>>>>>>>>>>>> constructor) and see where it is instantiated.
>>>>>>>>>>>> AjaxRequestHandler uses StringResponse, but
>>>>>>>>>>>> WebSocketRequestHandler
>>>>>>>>> does
>>>>>>>>>>>> not.
>>>>>>>>>>> I'm not completely sure but it seems that all the times the
>>>>>>>>>>> application
>>>>>>>>>>> enters in [1] (including when "script" contains 
>>>>>>>>>>> "addEnpoint(...)")
>>>>>>>>>>> and
>>>>>>>>>>> then the "StringResponse()" constructor is called, the source
>>>>>>>>>>> is [2].
>>>>>>>>>>>
>>>>>>>>>>> [1]
>>>>>>>>>>>
>>>>>>>>>>>
>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141 
>>>
>>>>>>>>>>> [2]
>>>>>>>>>>>
>>>>>>>>>>>
>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestHandler.java#L360 
>>>
>>>>>>>>>> It seems WebSocketRequestHandler#respond() is not called at all.
>>>>>>>>>> Put a breakpoint in AbstractWebSocketProcessor and see what 
>>>>>>>>>> happens
>>>>>>>>> there.
>>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>> ok thanks, I did that and the constructor of
>>>>>>>>> "AbstractWebSocketProcessor" is never called!
>>>>>>>>>
>>>>>>>> The constructor should be called when the WS connection is
>>>>>>>> established.
>>>>>>>> I guess you use wicket-native-websocket-javax.
>>>>>>>> Check org.apache.wicket.protocol.ws.javax.JavaxWebSocketProcessor
>>> and
>>>>>>>> its
>>>>>>>> org.apache.wicket.protocol.ws
>>>>>> .javax.JavaxWebSocketProcessor.StringMessageHandler
>>>>>>>> onMessage() method is called when the client sends something to 
>>>>>>>> the
>>>>>>>> server.
>>>>>>>> onMessage() delegates
>>>>>>>> to
>>>>>>>> org.apache.wicket.protocol.ws
>>>>>> .api.AbstractWebSocketProcessor#broadcastMessage()
>>>>>>>> where the processing happens, i.e. 
>>>>>>>> WebSocketBehavior#onMessage() is
>>>>>>>> called.
>>>>>>> Yes we use "wicket-native-websocket-javax" [1].
>>>>>>> What I have just done is putting a breackpoint in both that method
>>>>>>> from
>>>>>>>
>>> "org.apache.wicket.protocol.ws.javax.JavaxWebSocketProcessor#StringMessageHandler 
>>>
>>>
>>>>>>> onMessage()" and
>>>>>>>
>>> "org.apache.wicket.protocol.ws.api.AbstractWebSocketProcessor#broadcastMessage()", 
>>>
>>>
>>>>>>
>>>>>>> but it does *not* enter there either.
>>>>>>>
>>>>>>> So at that point I have tried to start v2.0.x with Wicket 7.x and
>>>>>>> tried to debug the same way, the result is that it enters in [2] 
>>>>>>> only.
>>>>>>>
>>>>>>>
>>>>>>> [1]
>>>>>>>
>>> https://github.com/apache/syncope/blob/2_1_X/client/console/pom.xml#L83
>>>>>>> [2]
>>>>>>>
>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/JavaxWebSocketProcessor.java#L65 
>>>
>>>>>>
>>>>>> Sorry I correct myself, I tried again with 2.1.x (Wicket 8.x) and it
>>>>>> entered in [1] and [2].
>>>>>>
>>>>>> [1]
>>>>>>
>>>>>>
>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/JavaxWebSocketProcessor.java#L65 
>>>
>>>>>>
>>>>>> [2]
>>>>>>
>>>>>>
>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketProcessor.java#L213 
>>>
>>>>> Once the debugger is here set another breakpoint at
>>>>>
>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java#L840 
>>>
>>>>> and
>>>>>
>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java#L871 
>>>
>>>>>
>>>>> it seems something removes WebSocketRequestHandler from the 
>>>>> pipeline and
>>>>> that's why its #respond() method is not executed.
>>>> Ok, it enters just a couple of times in [1] right after [2] and [3].
>>>>
>>>> [1]
>>>>
>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java#L840 
>>>
>>>> [2]
>>>>
>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/JavaxWebSocketProcessor.java#L65 
>>>
>>>> [3]
>>>>
>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketProcessor.java#L213 
>>>
>>>
>>>
>>> Hi Grigorov,
>>>
>>> is there anything else I can do for this?
>>> Is there a chance you reproduced it?
>>>
>>> Thanks!
>>>
>>>
>>>>>>>>>>>>> <?xml version="1.0" 
>>>>>>>>>>>>> encoding="UTF-8"?><ajax-response><component
>>>>>>>>>>>>> id="id178" ><![CDATA[<span id="id178">
>>>>>>>>>>>>> <div class="wizard-form">
>>>>>>>>>>>>> <div id="id204">
>>>>>>>>>>>>> <div class="wizard-overview">
>>>>>>>>>>>>>
>>>>>>>>>>>>> </div>
>>>>>>>>>>>>> <div class="wizard-header">
>>>>>>>>>>>>> <div>
>>>>>>>>>>>>> <div>
>>>>>>>>>>>>> <div class="wizard-step-title">
>>>>>>>>>>>>> <div></div>
>>>>>>>>>>>>> </div>
>>>>>>>>>>>>> <div class="wizard-step-summary">
>>>>>>>>>>>>> <div></div>
>>>>>>>>>>>>> </div>
>>>>>>>>>>>>> </div>
>>>>>>>>>>>>> </div>
>>>>>>>>>>>>> </div>
>>>>>>>>>>>>> <div class="wizard-view">
>>>>>>>>>>>>> <div id="id207">
>>>>>>>>>>>>> <span id="id226">
>>>>>>>>>>>>> <span id="id227">
>>>>>>>>>>>>>
>>>>>>>>>>>>> ...
>>>>>>>>>>>>>
>>>>>>>>>>>>>>> [1]
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141 
>>>
>>>>>>>>>>>>>>> [2]
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86 
>>>
>>>>>>>>>>>>>>>>> Thanks
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> What is the type of resourceCreateEvent.getTarget() ?
>>>>>>>>>>>>>>>>>>>> Is it WebSocketRequestHandler or AjaxRequestHandler ?
>>>>>>>>>>>>>>>>>>> "resourceCreateEvent.getTarget()"type is
>>>>>>>>>>>>>>>>>>> "AjaxRequestHandler".
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> [1]
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609 
>>>
>>>>>>>>>>>>>>>>>>>>> On 21/02/19 10:01, Martin Grigorov wrote:
>>>>>>>>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> Check the browser's Dev Tools' console for any
>>>>>>>>>>>>>>>>>>>>>> JavaScript
>>>>>>>>>>> errors.
>>>>>>>>>>>>>>>>>>>>>> If there are no errors then check in the DevTools
>>>>>>>>>>>>>>>>>>>>>> Network tab
>>>>>>>>>>>>>>> whether
>>>>>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>>>>>>>> WebSocket response frame contains the JS code in its
>>>>>>>>>>>>>>>>>>>>>> body. It
>>>>>>>>>>>>> must
>>>>>>>>>>>>>>> be
>>>>>>>>>>>>>>>>>>>>>> inside <execution> XML element. If it is not there
>>>>>>>>>>>>>>>>>>>>>> at all
>>>>>>>>> then
>>>>>>>>>>> it
>>>>>>>>>>>>>>>>> must
>>>>>>>>>>>>>>>>>>> be
>>>>>>>>>>>>>>>>>>>>>> something on the server side.
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> On Thu, Feb 21, 2019 at 10:54 AM Matteo 
>>>>>>>>>>>>>>>>>>>>>> Alessandroni <
>>>>>>>>>>>>>>>>>>>>> skylark17@apache.org>
>>>>>>>>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>> we have a logic where a websocket message is sent
>>>>>>>>>>>>>>>>>>>>>>> from an
>>>>>>>>>>>>>>>>> "onEvent()"
>>>>>>>>>>>>>>>>>>>>>>> method [1] and catched in a WebSocketBehavior class
>>>>>>>>>>>>>>>>>>>>>>> [2].
>>>>>>>>>>>>>>>>>>>>>>> Then, a call to a js method "addEndpoint()"[3] 
>>>>>>>>>>>>>>>>>>>>>>> must be
>>>>>>>>>>> executed.
>>>>>>>>>>>>>>>>>>>>>>> Our problem is that the js code "addEndpoint(...)"
>>>>>>>>>>>>>>>>>>>>>>> inside
>>>>>>>>>>>>>>>>>>>>>>> "handler.appendJavaScript(...)" [4] is not 
>>>>>>>>>>>>>>>>>>>>>>> executed,
>>>>>>>>>>>>>>>>>>>>>>> so the
>>>>>>>>>>> code
>>>>>>>>>>>>>>>>>>>>>>> correctly reaches that switch case but it's like 
>>>>>>>>>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>>>>>>>>> "appendJavaScript(...)" is not working.
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>> On our application v2.0.x that code works and it 
>>>>>>>>>>>>>>>>>>>>>>> uses
>>>>>>>>>>>>>>>>>>>>>>> Wicket
>>>>>>>>>>>>> 7.x,
>>>>>>>>>>>>>>>>>>> while
>>>>>>>>>>>>>>>>>>>>>>> the newer v2.1.x  uses Wicket 8.x and it does not
>>>>>>>>>>>>>>>>>>>>>>> work.
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>> Could you please give us an hint of this? Is there
>>>>>>>>>>>>>>>>>>>>>>> anything
>>>>>>>>> we
>>>>>>>>>>>>> are
>>>>>>>>>>>>>>>>>>>>>>> missing to make it work for Wicket 8.x?
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>> Thank you!
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>> [1]
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>
>>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609 
>>>
>>>>>>>>>>>>>>>>>>>>>>> [2]
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>
>>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L153-L157 
>>>
>>>>>>>>>>>>>>>>>>>>>>> [3]
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>
>>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/resources/META-INF/resources/js/topology.js#L269-L280 
>>>
>>>>>>>>>>>>>>>>>>>>>>> [4]
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>
>>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L154 
>>>
>>>>>>>>>>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17 
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>> <
>>> http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17> 
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>
>>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>>
>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>>
>>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>>
>>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>>>
>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>>
>>>>>>>>>>> -- 
>>>>>>>>>>>
>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>
>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>
>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>
>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>
>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>
>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>
>>>>>>>>> -- 
>>>>>>>>>
>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>
>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>
>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>
>>>>>>>>> http://www.tirasa.net
>>>>>>>>>
>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>
>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>
>>>>>> -- 
>>>>>>
>>>>>> Dott. Matteo Alessandroni
>>>>>>
>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>
>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>
>>>>>> http://www.tirasa.net
>>>>>>
>>>>>> Apache Syncope PMC Member
>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>
>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>
>>> -- 
>>>
>>> Dott. Matteo Alessandroni
>>>
>>> Software Engineer @ Tirasa S.r.l.
>>>
>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>> Tel +39 0859116307 / FAX +39 0859111173
>>>
>>> http://www.tirasa.net
>>>
>>> Apache Syncope PMC Member
>>> http://people.apache.org/phonebook.html?uid=skylark17
>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>
>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: WebSocketRequestHandler object not executing javascript code

Posted by Martin Grigorov <mg...@apache.org>.
On Thu, Feb 28, 2019 at 5:28 PM Matteo Alessandroni <sk...@apache.org>
wrote:

>
>
> On 28/02/19 15:11, Martin Grigorov wrote:
> > Hi,
> >
> > I've explained you earlier where to look at.
> > WebSocketRequestHandler#respond() is not called for some reason.
> > It is scheduled in AbstractWebSocketProcessor with
> > requestCycle#scheduleAfterCurrent() but it seems later another
> > IRequestHandler is scheduled and replaced it.
> >
> > If you can reproduce in a mini application I would be happy to debug it.
> >
> > On Thu, Feb 28, 2019 at 3:51 PM Matteo Alessandroni <
> skylark17@apache.org>
> > wrote:
>
> Hi,
>
> our application is open source and you can easily reproduce the issue.
>

It is open source but it is not mini.
My spare time is limited.
If you'd like to pay for my services then I will debug the problem in the
business hours.


> If you are available to debug it, here are the simple steps to start
> Syncope and reproduce the case:
>
>   * Download source code from [1] e go to branch 2_1_X;
>   * Build and run it by running:
>     mvn -PskipTests,all && cd fit/enduser-reference && mvn -Pdebug;
>   * Go to http://localhost:9080/syncope-console/, login with "admin /
>     admin" and click on "Topology" from the left menu;
>   * Click on the first node from the bottom and select "Add new connector";
>   * Fill the required fields (with "*") with random values, select
>     "net.tirasa.connid.bundles.soap" in the "Bundle *" dropdown and
>     click "Next";
>   * Insert random values for the "Service Endpoint *" and "Service name
>     *" fields, click "Next" again, then click "Finish". A connector node
>     is now created;
>
> The issue is that the node should be visible as soon as the wizard
> disappears (after finish), but, instead, it's not until you refresh the
> page (e.g. click on "Topology" again).
> The notable parts in the code are on [2] and [3] (as mentioned before).
>
> I really appreciate your help!
> Thank you!
>
> [1] https://github.com/apache/syncope/tree/2_1_X
>
> [2]
>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
>
> [3]
>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L153-L158
>
>
>
> >
> >>
> >> On 22/02/19 12:55, Matteo Alessandroni wrote:
> >>>
> >>> On 22/02/19 12:46, Martin Grigorov wrote:
> >>>> On Fri, Feb 22, 2019 at 1:40 PM Matteo Alessandroni
> >>>> <sk...@apache.org>
> >>>> wrote:
> >>>>
> >>>>> On 22/02/19 12:28, Matteo Alessandroni wrote:
> >>>>>> On 22/02/19 10:31, Martin Grigorov wrote:
> >>>>>>> On Fri, Feb 22, 2019 at 10:50 AM Matteo Alessandroni
> >>>>>>> <sk...@apache.org>
> >>>>>>> wrote:
> >>>>>>>
> >>>>>>>> On 21/02/19 18:50, Martin Grigorov wrote:
> >>>>>>>>> On Thu, Feb 21, 2019, 18:29 Matteo Alessandroni
> >>>>>>>>> <skylark17@apache.org
> >>>>>>>>> wrote:
> >>>>>>>>>
> >>>>>>>>>> On 21/02/19 16:43, Martin Grigorov wrote:
> >>>>>>>>>>> On Thu, Feb 21, 2019 at 5:35 PM Matteo Alessandroni <
> >>>>>>>>>> skylark17@apache.org>
> >>>>>>>>>>> wrote:
> >>>>>>>>>>>
> >>>>>>>>>>>> On 21/02/19 16:30, Martin Grigorov wrote:
> >>>>>>>>>>>>> On Thu, Feb 21, 2019 at 5:24 PM Matteo Alessandroni <
> >>>>>>>>>>>> skylark17@apache.org>
> >>>>>>>>>>>>> wrote:
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>> On 21/02/19 16:07, Martin Grigorov wrote:
> >>>>>>>>>>>>>>> On Thu, Feb 21, 2019 at 4:41 PM Matteo Alessandroni <
> >>>>>>>>>>>>>> skylark17@apache.org>
> >>>>>>>>>>>>>>> wrote:
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> On 21/02/19 12:14, Martin Grigorov wrote:
> >>>>>>>>>>>>>>>>> On Thu, Feb 21, 2019 at 12:11 PM Matteo Alessandroni <
> >>>>>>>>>>>>>>>>> matteo.alessandroni@tirasa.net> wrote:
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> Hi,
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> On 21/02/19 11:05, Martin Grigorov wrote:
> >>>>>>>>>>>>>>>>>>> When the WebSocket connection is established (maybe
> >>>>>>>>>>>>>>>>>>> when the
> >>>>>>>> page
> >>>>>>>>>>>> is
> >>>>>>>>>>>>>>>>>>> loaded) you should see an entry in the Network tab.
> >>>>>>>>>>>>>>>>>>> If you select this entry then on the right-side you
> >>>>>>>>>>>>>>>>>>> should see
> >>>>>>>>>> any
> >>>>>>>>>>>> WS
> >>>>>>>>>>>>>>>>>>> messages to/from the server.
> >>>>>>>>>>>>>>>>>> Yes I know how about WS debugging, but I do not see any
> WS
> >>>>>>>> request
> >>>>>>>>>>>>>> (with
> >>>>>>>>>>>>>>>>>> WS devtool filter and without it).
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> Maybe this is the problem.
> >>>>>>>>>>>>>>>>> If there is no WebSocket response at all then there is no
> >>>>>>>>>>>>>>>>> way the
> >>>>>>>>>> JS
> >>>>>>>>>>>>>> code
> >>>>>>>>>>>>>>>>> to be executed.
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> But since your WebSocketBehavior callback method is
> >>>>>>>>>>>>>>>>> executed then
> >>>>>>>>>>>> there
> >>>>>>>>>>>>>>>>> must be an established WebSocket connection.
> >>>>>>>>>>>>>>>>> I have no idea what goes wrong.
> >>>>>>>>>>>>>>>> It is strange because in our application version that uses
> >>>>>>>>>>>>>>>> Wicket
> >>>>>>>>>> 7.x
> >>>>>>>>>>>> I
> >>>>>>>>>>>>>>>> see no WS requests in DevTools console as well, but the
> >>>>>>>>>>>>>>>> code is
> >>>>>>>>>>>>>>>> correctly executed and everything works.
> >>>>>>>>>>>>>>>> Yes the WebSocket connection seems to be established
> >>>>>>>>>>>>>>>> anyway in
> >>>>>>>> both
> >>>>>>>>>>>> our
> >>>>>>>>>>>>>>>> versions so with both Wicket 7.x and 8.x, but for some
> >>>>>>>>>>>>>>>> reason the
> >>>>>>>>>>>>>>>> "appendJavaScript()" method does not work on the
> >>>>>>>>>>>>>>>> "WebSocketRequestHandler" object with Wicket 8.x.
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> Is there anything else we can try to make it work?
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> Put a breakpoint at
> >>>>>>>>>>>>>>>
> >>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
> >>>>>>>>>>>>>>> and see whether it is called.
> >>>>>>>>>>>>>>> And another one at
> >>>>>>>>>>>>>>>
> >>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86
> >>>>>>>>>>>>>>> to see whether the XML response is being written back to
> the
> >>>>>>>> browser
> >>>>>>>>>> in
> >>>>>>>>>>>>>> the
> >>>>>>>>>>>>>>> WebSocketConnection.
> >>>>>>>>>>>>>> Thanks!
> >>>>>>>>>>>>>> Ok the first method [1] was called many times and once was
> the
> >>>>>>>>>>>>>> one
> >>>>>>>> I'm
> >>>>>>>>>>>>>> interested on where the "script" variable was:
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>>
> >>
> "window.Wicket.WebSocket.send('{"kind":"ADD_ENDPOINT","target":"...","source":"...","scope":"..."}');"
> >>
> >>>>>
> >>>>>>>>>>>>>> also the second one [2] was called, but *only once* and
> >>>>>>>>>>>>>> both the
> >>>>>>>>>> "text"
> >>>>>>>>>>>>>> and "binary" variables were null.
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>> What is the type of "response" variable at
> >>>>>>>>>>>>>
> >>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
> >>>>>>>>>>>>> ?
> >>>>>>>>>>>>> It seems it is not WebSocketResponse
> >>>>>>>>>>>> Ideed, it's "StringResponse"!
> >>>>>>>>>>>> And it's content is something like this:
> >>>>>>>>>>>>
> >>>>>>>>>>> I didn't expect this!
> >>>>>>>>>>> Can you please put a breakpoint
> >>>>>>>>>>> at org.apache.wicket.response.StringResponse#StringResponse()
> >>>>>>>>>>> (the
> >>>>>>>>>>> constructor) and see where it is instantiated.
> >>>>>>>>>>> AjaxRequestHandler uses StringResponse, but
> >>>>>>>>>>> WebSocketRequestHandler
> >>>>>>>> does
> >>>>>>>>>>> not.
> >>>>>>>>>> I'm not completely sure but it seems that all the times the
> >>>>>>>>>> application
> >>>>>>>>>> enters in [1] (including when "script" contains
> "addEnpoint(...)")
> >>>>>>>>>> and
> >>>>>>>>>> then the "StringResponse()" constructor is called, the source
> >>>>>>>>>> is [2].
> >>>>>>>>>>
> >>>>>>>>>> [1]
> >>>>>>>>>>
> >>>>>>>>>>
> >>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
> >>>>>>>>>> [2]
> >>>>>>>>>>
> >>>>>>>>>>
> >>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestHandler.java#L360
> >>>>>>>>> It seems WebSocketRequestHandler#respond() is not called at all.
> >>>>>>>>> Put a breakpoint in AbstractWebSocketProcessor and see what
> happens
> >>>>>>>> there.
> >>>>>>>>
> >>>>>>>> Hi,
> >>>>>>>> ok thanks, I did that and the constructor of
> >>>>>>>> "AbstractWebSocketProcessor" is never called!
> >>>>>>>>
> >>>>>>> The constructor should be called when the WS connection is
> >>>>>>> established.
> >>>>>>> I guess you use wicket-native-websocket-javax.
> >>>>>>> Check org.apache.wicket.protocol.ws.javax.JavaxWebSocketProcessor
> >> and
> >>>>>>> its
> >>>>>>> org.apache.wicket.protocol.ws
> >>>>> .javax.JavaxWebSocketProcessor.StringMessageHandler
> >>>>>>> onMessage() method is called when the client sends something to the
> >>>>>>> server.
> >>>>>>> onMessage() delegates
> >>>>>>> to
> >>>>>>> org.apache.wicket.protocol.ws
> >>>>> .api.AbstractWebSocketProcessor#broadcastMessage()
> >>>>>>> where the processing happens, i.e. WebSocketBehavior#onMessage() is
> >>>>>>> called.
> >>>>>> Yes we use "wicket-native-websocket-javax" [1].
> >>>>>> What I have just done is putting a breackpoint in both that method
> >>>>>> from
> >>>>>>
> >>
> "org.apache.wicket.protocol.ws.javax.JavaxWebSocketProcessor#StringMessageHandler
> >>
> >>>>>> onMessage()" and
> >>>>>>
> >>
> "org.apache.wicket.protocol.ws.api.AbstractWebSocketProcessor#broadcastMessage()",
> >>
> >>>>>
> >>>>>> but it does *not* enter there either.
> >>>>>>
> >>>>>> So at that point I have tried to start v2.0.x with Wicket 7.x and
> >>>>>> tried to debug the same way, the result is that it enters in [2]
> only.
> >>>>>>
> >>>>>>
> >>>>>> [1]
> >>>>>>
> >> https://github.com/apache/syncope/blob/2_1_X/client/console/pom.xml#L83
> >>>>>> [2]
> >>>>>>
> >>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/JavaxWebSocketProcessor.java#L65
> >>>>>
> >>>>> Sorry I correct myself, I tried again with 2.1.x (Wicket 8.x) and it
> >>>>> entered in [1] and [2].
> >>>>>
> >>>>> [1]
> >>>>>
> >>>>>
> >>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/JavaxWebSocketProcessor.java#L65
> >>>>>
> >>>>> [2]
> >>>>>
> >>>>>
> >>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketProcessor.java#L213
> >>>> Once the debugger is here set another breakpoint at
> >>>>
> >>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java#L840
> >>>> and
> >>>>
> >>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java#L871
> >>>>
> >>>> it seems something removes WebSocketRequestHandler from the pipeline
> and
> >>>> that's why its #respond() method is not executed.
> >>> Ok, it enters just a couple of times in [1] right after [2] and [3].
> >>>
> >>> [1]
> >>>
> >>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java#L840
> >>> [2]
> >>>
> >>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/JavaxWebSocketProcessor.java#L65
> >>> [3]
> >>>
> >>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketProcessor.java#L213
> >>
> >>
> >> Hi Grigorov,
> >>
> >> is there anything else I can do for this?
> >> Is there a chance you reproduced it?
> >>
> >> Thanks!
> >>
> >>
> >>>>>>>>>>>> <?xml version="1.0"
> encoding="UTF-8"?><ajax-response><component
> >>>>>>>>>>>> id="id178" ><![CDATA[<span id="id178">
> >>>>>>>>>>>> <div class="wizard-form">
> >>>>>>>>>>>> <div id="id204">
> >>>>>>>>>>>> <div class="wizard-overview">
> >>>>>>>>>>>>
> >>>>>>>>>>>> </div>
> >>>>>>>>>>>> <div class="wizard-header">
> >>>>>>>>>>>> <div>
> >>>>>>>>>>>> <div>
> >>>>>>>>>>>> <div class="wizard-step-title">
> >>>>>>>>>>>> <div></div>
> >>>>>>>>>>>> </div>
> >>>>>>>>>>>> <div class="wizard-step-summary">
> >>>>>>>>>>>> <div></div>
> >>>>>>>>>>>> </div>
> >>>>>>>>>>>> </div>
> >>>>>>>>>>>> </div>
> >>>>>>>>>>>> </div>
> >>>>>>>>>>>> <div class="wizard-view">
> >>>>>>>>>>>> <div id="id207">
> >>>>>>>>>>>> <span id="id226">
> >>>>>>>>>>>> <span id="id227">
> >>>>>>>>>>>>
> >>>>>>>>>>>> ...
> >>>>>>>>>>>>
> >>>>>>>>>>>>>> [1]
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>>
> >>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
> >>>>>>>>>>>>>> [2]
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>>
> >>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86
> >>>>>>>>>>>>>>>> Thanks
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>> What is the type of resourceCreateEvent.getTarget() ?
> >>>>>>>>>>>>>>>>>>> Is it WebSocketRequestHandler or AjaxRequestHandler ?
> >>>>>>>>>>>>>>>>>> "resourceCreateEvent.getTarget()"type is
> >>>>>>>>>>>>>>>>>> "AjaxRequestHandler".
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>> [1]
> >>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
> >>>>>>>>>>>>>>>>>>>> On 21/02/19 10:01, Martin Grigorov wrote:
> >>>>>>>>>>>>>>>>>>>>> Hi,
> >>>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>>> Check the browser's Dev Tools' console for any
> >>>>>>>>>>>>>>>>>>>>> JavaScript
> >>>>>>>>>> errors.
> >>>>>>>>>>>>>>>>>>>>> If there are no errors then check in the DevTools
> >>>>>>>>>>>>>>>>>>>>> Network tab
> >>>>>>>>>>>>>> whether
> >>>>>>>>>>>>>>>>>> the
> >>>>>>>>>>>>>>>>>>>>> WebSocket response frame contains the JS code in its
> >>>>>>>>>>>>>>>>>>>>> body. It
> >>>>>>>>>>>> must
> >>>>>>>>>>>>>> be
> >>>>>>>>>>>>>>>>>>>>> inside <execution> XML element. If it is not there
> >>>>>>>>>>>>>>>>>>>>> at all
> >>>>>>>> then
> >>>>>>>>>> it
> >>>>>>>>>>>>>>>> must
> >>>>>>>>>>>>>>>>>> be
> >>>>>>>>>>>>>>>>>>>>> something on the server side.
> >>>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>>> On Thu, Feb 21, 2019 at 10:54 AM Matteo Alessandroni
> <
> >>>>>>>>>>>>>>>>>>>> skylark17@apache.org>
> >>>>>>>>>>>>>>>>>>>>> wrote:
> >>>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>>>> Hi,
> >>>>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>>>> we have a logic where a websocket message is sent
> >>>>>>>>>>>>>>>>>>>>>> from an
> >>>>>>>>>>>>>>>> "onEvent()"
> >>>>>>>>>>>>>>>>>>>>>> method [1] and catched in a WebSocketBehavior class
> >>>>>>>>>>>>>>>>>>>>>> [2].
> >>>>>>>>>>>>>>>>>>>>>> Then, a call to a js method "addEndpoint()"[3] must
> be
> >>>>>>>>>> executed.
> >>>>>>>>>>>>>>>>>>>>>> Our problem is that the js code "addEndpoint(...)"
> >>>>>>>>>>>>>>>>>>>>>> inside
> >>>>>>>>>>>>>>>>>>>>>> "handler.appendJavaScript(...)" [4] is not executed,
> >>>>>>>>>>>>>>>>>>>>>> so the
> >>>>>>>>>> code
> >>>>>>>>>>>>>>>>>>>>>> correctly reaches that switch case but it's like the
> >>>>>>>>>>>>>>>>>>>>>> "appendJavaScript(...)" is not working.
> >>>>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>>>> On our application v2.0.x that code works and it
> uses
> >>>>>>>>>>>>>>>>>>>>>> Wicket
> >>>>>>>>>>>> 7.x,
> >>>>>>>>>>>>>>>>>> while
> >>>>>>>>>>>>>>>>>>>>>> the newer v2.1.x  uses Wicket 8.x and it does not
> >>>>>>>>>>>>>>>>>>>>>> work.
> >>>>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>>>> Could you please give us an hint of this? Is there
> >>>>>>>>>>>>>>>>>>>>>> anything
> >>>>>>>> we
> >>>>>>>>>>>> are
> >>>>>>>>>>>>>>>>>>>>>> missing to make it work for Wicket 8.x?
> >>>>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>>>> Thank you!
> >>>>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>>>> [1]
> >>>>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>>>>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
> >>>>>>>>>>>>>>>>>>>>>> [2]
> >>>>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>>>>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L153-L157
> >>>>>>>>>>>>>>>>>>>>>> [3]
> >>>>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>>>>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/resources/META-INF/resources/js/topology.js#L269-L280
> >>>>>>>>>>>>>>>>>>>>>> [4]
> >>>>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>>>>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L154
> >>>>>>>>>>>>>>>>>>>>>> --
> >>>>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>>>> Dott. Matteo Alessandroni
> >>>>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>>>>>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>>>> http://www.tirasa.net
> >>>>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>>>> Apache Syncope PMC Member
> >>>>>>>>>>>>>>>>>>>>>>
> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>>>>>>>>>>>>>>>>>> <
> >> http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>> --
> >>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>> Dott. Matteo Alessandroni
> >>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>>>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>> http://www.tirasa.net
> >>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>> Apache Syncope PMC Member
> >>>>>>>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>>>>>>>>>>>>>>>> <
> http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> --
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> Dott. Matteo Alessandroni
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> http://www.tirasa.net
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> Apache Syncope PMC Member
> >>>>>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> --
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> Dott. Matteo Alessandroni
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> http://www.tirasa.net
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> Apache Syncope PMC Member
> >>>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>> --
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Dott. Matteo Alessandroni
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> http://www.tirasa.net
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Apache Syncope PMC Member
> >>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>>>>>>>>>
> >>>>>>>>>>>> --
> >>>>>>>>>>>>
> >>>>>>>>>>>> Dott. Matteo Alessandroni
> >>>>>>>>>>>>
> >>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>>>>>>>
> >>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>>>>>>>
> >>>>>>>>>>>> http://www.tirasa.net
> >>>>>>>>>>>>
> >>>>>>>>>>>> Apache Syncope PMC Member
> >>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>>>>>>>
> >>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>>>>>>>
> >>>>>>>>>> --
> >>>>>>>>>>
> >>>>>>>>>> Dott. Matteo Alessandroni
> >>>>>>>>>>
> >>>>>>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>>>>>
> >>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>>>>>
> >>>>>>>>>> http://www.tirasa.net
> >>>>>>>>>>
> >>>>>>>>>> Apache Syncope PMC Member
> >>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>>>>>
> >>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>>>>>
> >>>>>>>> --
> >>>>>>>>
> >>>>>>>> Dott. Matteo Alessandroni
> >>>>>>>>
> >>>>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>>>
> >>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>>>
> >>>>>>>> http://www.tirasa.net
> >>>>>>>>
> >>>>>>>> Apache Syncope PMC Member
> >>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>>>
> >>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>>>
> >>>>> --
> >>>>>
> >>>>> Dott. Matteo Alessandroni
> >>>>>
> >>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>
> >>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>
> >>>>> http://www.tirasa.net
> >>>>>
> >>>>> Apache Syncope PMC Member
> >>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>
> >>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>
> >> --
> >>
> >> Dott. Matteo Alessandroni
> >>
> >> Software Engineer @ Tirasa S.r.l.
> >>
> >> Viale Vittoria Colonna, 97 - 65127 Pescara
> >> Tel +39 0859116307 / FAX +39 0859111173
> >>
> >> http://www.tirasa.net
> >>
> >> Apache Syncope PMC Member
> >> http://people.apache.org/phonebook.html?uid=skylark17
> >> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>
> >> Tirasa S.r.l. <http://www.tirasa.net>
> >>
>
> --
>
> Dott. Matteo Alessandroni
>
> Software Engineer @ Tirasa S.r.l.
>
> Viale Vittoria Colonna, 97 - 65127 Pescara
> Tel +39 0859116307 / FAX +39 0859111173
>
> http://www.tirasa.net
>
> Apache Syncope PMC Member
> http://people.apache.org/phonebook.html?uid=skylark17
> <http://people.apache.org/phonebook.html?uid=skylark17>
>
> Tirasa S.r.l. <http://www.tirasa.net>
>

Re: WebSocketRequestHandler object not executing javascript code

Posted by Matteo Alessandroni <sk...@apache.org>.

On 28/02/19 15:11, Martin Grigorov wrote:
> Hi,
>
> I've explained you earlier where to look at.
> WebSocketRequestHandler#respond() is not called for some reason.
> It is scheduled in AbstractWebSocketProcessor with
> requestCycle#scheduleAfterCurrent() but it seems later another
> IRequestHandler is scheduled and replaced it.
>
> If you can reproduce in a mini application I would be happy to debug it.
>
> On Thu, Feb 28, 2019 at 3:51 PM Matteo Alessandroni <sk...@apache.org>
> wrote:

Hi,

our application is open source and you can easily reproduce the issue.
If you are available to debug it, here are the simple steps to start 
Syncope and reproduce the case:

  * Download source code from [1] e go to branch 2_1_X;
  * Build and run it by running:
    mvn -PskipTests,all && cd fit/enduser-reference && mvn -Pdebug;
  * Go to http://localhost:9080/syncope-console/, login with "admin /
    admin" and click on "Topology" from the left menu;
  * Click on the first node from the bottom and select "Add new connector";
  * Fill the required fields (with "*") with random values, select
    "net.tirasa.connid.bundles.soap" in the "Bundle *" dropdown and
    click "Next";
  * Insert random values for the "Service Endpoint *" and "Service name
    *" fields, click "Next" again, then click "Finish". A connector node
    is now created;

The issue is that the node should be visible as soon as the wizard 
disappears (after finish), but, instead, it's not until you refresh the 
page (e.g. click on "Topology" again).
The notable parts in the code are on [2] and [3] (as mentioned before).

I really appreciate your help!
Thank you!

[1] https://github.com/apache/syncope/tree/2_1_X

[2] 
https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609

[3] 
https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L153-L158



>
>>
>> On 22/02/19 12:55, Matteo Alessandroni wrote:
>>>
>>> On 22/02/19 12:46, Martin Grigorov wrote:
>>>> On Fri, Feb 22, 2019 at 1:40 PM Matteo Alessandroni
>>>> <sk...@apache.org>
>>>> wrote:
>>>>
>>>>> On 22/02/19 12:28, Matteo Alessandroni wrote:
>>>>>> On 22/02/19 10:31, Martin Grigorov wrote:
>>>>>>> On Fri, Feb 22, 2019 at 10:50 AM Matteo Alessandroni
>>>>>>> <sk...@apache.org>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> On 21/02/19 18:50, Martin Grigorov wrote:
>>>>>>>>> On Thu, Feb 21, 2019, 18:29 Matteo Alessandroni
>>>>>>>>> <skylark17@apache.org
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> On 21/02/19 16:43, Martin Grigorov wrote:
>>>>>>>>>>> On Thu, Feb 21, 2019 at 5:35 PM Matteo Alessandroni <
>>>>>>>>>> skylark17@apache.org>
>>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> On 21/02/19 16:30, Martin Grigorov wrote:
>>>>>>>>>>>>> On Thu, Feb 21, 2019 at 5:24 PM Matteo Alessandroni <
>>>>>>>>>>>> skylark17@apache.org>
>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>> On 21/02/19 16:07, Martin Grigorov wrote:
>>>>>>>>>>>>>>> On Thu, Feb 21, 2019 at 4:41 PM Matteo Alessandroni <
>>>>>>>>>>>>>> skylark17@apache.org>
>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> On 21/02/19 12:14, Martin Grigorov wrote:
>>>>>>>>>>>>>>>>> On Thu, Feb 21, 2019 at 12:11 PM Matteo Alessandroni <
>>>>>>>>>>>>>>>>> matteo.alessandroni@tirasa.net> wrote:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> On 21/02/19 11:05, Martin Grigorov wrote:
>>>>>>>>>>>>>>>>>>> When the WebSocket connection is established (maybe
>>>>>>>>>>>>>>>>>>> when the
>>>>>>>> page
>>>>>>>>>>>> is
>>>>>>>>>>>>>>>>>>> loaded) you should see an entry in the Network tab.
>>>>>>>>>>>>>>>>>>> If you select this entry then on the right-side you
>>>>>>>>>>>>>>>>>>> should see
>>>>>>>>>> any
>>>>>>>>>>>> WS
>>>>>>>>>>>>>>>>>>> messages to/from the server.
>>>>>>>>>>>>>>>>>> Yes I know how about WS debugging, but I do not see any WS
>>>>>>>> request
>>>>>>>>>>>>>> (with
>>>>>>>>>>>>>>>>>> WS devtool filter and without it).
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Maybe this is the problem.
>>>>>>>>>>>>>>>>> If there is no WebSocket response at all then there is no
>>>>>>>>>>>>>>>>> way the
>>>>>>>>>> JS
>>>>>>>>>>>>>> code
>>>>>>>>>>>>>>>>> to be executed.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> But since your WebSocketBehavior callback method is
>>>>>>>>>>>>>>>>> executed then
>>>>>>>>>>>> there
>>>>>>>>>>>>>>>>> must be an established WebSocket connection.
>>>>>>>>>>>>>>>>> I have no idea what goes wrong.
>>>>>>>>>>>>>>>> It is strange because in our application version that uses
>>>>>>>>>>>>>>>> Wicket
>>>>>>>>>> 7.x
>>>>>>>>>>>> I
>>>>>>>>>>>>>>>> see no WS requests in DevTools console as well, but the
>>>>>>>>>>>>>>>> code is
>>>>>>>>>>>>>>>> correctly executed and everything works.
>>>>>>>>>>>>>>>> Yes the WebSocket connection seems to be established
>>>>>>>>>>>>>>>> anyway in
>>>>>>>> both
>>>>>>>>>>>> our
>>>>>>>>>>>>>>>> versions so with both Wicket 7.x and 8.x, but for some
>>>>>>>>>>>>>>>> reason the
>>>>>>>>>>>>>>>> "appendJavaScript()" method does not work on the
>>>>>>>>>>>>>>>> "WebSocketRequestHandler" object with Wicket 8.x.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Is there anything else we can try to make it work?
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Put a breakpoint at
>>>>>>>>>>>>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
>>>>>>>>>>>>>>> and see whether it is called.
>>>>>>>>>>>>>>> And another one at
>>>>>>>>>>>>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86
>>>>>>>>>>>>>>> to see whether the XML response is being written back to the
>>>>>>>> browser
>>>>>>>>>> in
>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>> WebSocketConnection.
>>>>>>>>>>>>>> Thanks!
>>>>>>>>>>>>>> Ok the first method [1] was called many times and once was the
>>>>>>>>>>>>>> one
>>>>>>>> I'm
>>>>>>>>>>>>>> interested on where the "script" variable was:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>> "window.Wicket.WebSocket.send('{"kind":"ADD_ENDPOINT","target":"...","source":"...","scope":"..."}');"
>>
>>>>>
>>>>>>>>>>>>>> also the second one [2] was called, but *only once* and
>>>>>>>>>>>>>> both the
>>>>>>>>>> "text"
>>>>>>>>>>>>>> and "binary" variables were null.
>>>>>>>>>>>>>>
>>>>>>>>>>>>> What is the type of "response" variable at
>>>>>>>>>>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
>>>>>>>>>>>>> ?
>>>>>>>>>>>>> It seems it is not WebSocketResponse
>>>>>>>>>>>> Ideed, it's "StringResponse"!
>>>>>>>>>>>> And it's content is something like this:
>>>>>>>>>>>>
>>>>>>>>>>> I didn't expect this!
>>>>>>>>>>> Can you please put a breakpoint
>>>>>>>>>>> at org.apache.wicket.response.StringResponse#StringResponse()
>>>>>>>>>>> (the
>>>>>>>>>>> constructor) and see where it is instantiated.
>>>>>>>>>>> AjaxRequestHandler uses StringResponse, but
>>>>>>>>>>> WebSocketRequestHandler
>>>>>>>> does
>>>>>>>>>>> not.
>>>>>>>>>> I'm not completely sure but it seems that all the times the
>>>>>>>>>> application
>>>>>>>>>> enters in [1] (including when "script" contains "addEnpoint(...)")
>>>>>>>>>> and
>>>>>>>>>> then the "StringResponse()" constructor is called, the source
>>>>>>>>>> is [2].
>>>>>>>>>>
>>>>>>>>>> [1]
>>>>>>>>>>
>>>>>>>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
>>>>>>>>>> [2]
>>>>>>>>>>
>>>>>>>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestHandler.java#L360
>>>>>>>>> It seems WebSocketRequestHandler#respond() is not called at all.
>>>>>>>>> Put a breakpoint in AbstractWebSocketProcessor and see what happens
>>>>>>>> there.
>>>>>>>>
>>>>>>>> Hi,
>>>>>>>> ok thanks, I did that and the constructor of
>>>>>>>> "AbstractWebSocketProcessor" is never called!
>>>>>>>>
>>>>>>> The constructor should be called when the WS connection is
>>>>>>> established.
>>>>>>> I guess you use wicket-native-websocket-javax.
>>>>>>> Check org.apache.wicket.protocol.ws.javax.JavaxWebSocketProcessor
>> and
>>>>>>> its
>>>>>>> org.apache.wicket.protocol.ws
>>>>> .javax.JavaxWebSocketProcessor.StringMessageHandler
>>>>>>> onMessage() method is called when the client sends something to the
>>>>>>> server.
>>>>>>> onMessage() delegates
>>>>>>> to
>>>>>>> org.apache.wicket.protocol.ws
>>>>> .api.AbstractWebSocketProcessor#broadcastMessage()
>>>>>>> where the processing happens, i.e. WebSocketBehavior#onMessage() is
>>>>>>> called.
>>>>>> Yes we use "wicket-native-websocket-javax" [1].
>>>>>> What I have just done is putting a breackpoint in both that method
>>>>>> from
>>>>>>
>> "org.apache.wicket.protocol.ws.javax.JavaxWebSocketProcessor#StringMessageHandler
>>
>>>>>> onMessage()" and
>>>>>>
>> "org.apache.wicket.protocol.ws.api.AbstractWebSocketProcessor#broadcastMessage()",
>>
>>>>>
>>>>>> but it does *not* enter there either.
>>>>>>
>>>>>> So at that point I have tried to start v2.0.x with Wicket 7.x and
>>>>>> tried to debug the same way, the result is that it enters in [2] only.
>>>>>>
>>>>>>
>>>>>> [1]
>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/pom.xml#L83
>>>>>> [2]
>>>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/JavaxWebSocketProcessor.java#L65
>>>>>
>>>>> Sorry I correct myself, I tried again with 2.1.x (Wicket 8.x) and it
>>>>> entered in [1] and [2].
>>>>>
>>>>> [1]
>>>>>
>>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/JavaxWebSocketProcessor.java#L65
>>>>>
>>>>> [2]
>>>>>
>>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketProcessor.java#L213
>>>> Once the debugger is here set another breakpoint at
>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java#L840
>>>> and
>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java#L871
>>>>
>>>> it seems something removes WebSocketRequestHandler from the pipeline and
>>>> that's why its #respond() method is not executed.
>>> Ok, it enters just a couple of times in [1] right after [2] and [3].
>>>
>>> [1]
>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java#L840
>>> [2]
>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/JavaxWebSocketProcessor.java#L65
>>> [3]
>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketProcessor.java#L213
>>
>>
>> Hi Grigorov,
>>
>> is there anything else I can do for this?
>> Is there a chance you reproduced it?
>>
>> Thanks!
>>
>>
>>>>>>>>>>>> <?xml version="1.0" encoding="UTF-8"?><ajax-response><component
>>>>>>>>>>>> id="id178" ><![CDATA[<span id="id178">
>>>>>>>>>>>> <div class="wizard-form">
>>>>>>>>>>>> <div id="id204">
>>>>>>>>>>>> <div class="wizard-overview">
>>>>>>>>>>>>
>>>>>>>>>>>> </div>
>>>>>>>>>>>> <div class="wizard-header">
>>>>>>>>>>>> <div>
>>>>>>>>>>>> <div>
>>>>>>>>>>>> <div class="wizard-step-title">
>>>>>>>>>>>> <div></div>
>>>>>>>>>>>> </div>
>>>>>>>>>>>> <div class="wizard-step-summary">
>>>>>>>>>>>> <div></div>
>>>>>>>>>>>> </div>
>>>>>>>>>>>> </div>
>>>>>>>>>>>> </div>
>>>>>>>>>>>> </div>
>>>>>>>>>>>> <div class="wizard-view">
>>>>>>>>>>>> <div id="id207">
>>>>>>>>>>>> <span id="id226">
>>>>>>>>>>>> <span id="id227">
>>>>>>>>>>>>
>>>>>>>>>>>> ...
>>>>>>>>>>>>
>>>>>>>>>>>>>> [1]
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
>>>>>>>>>>>>>> [2]
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86
>>>>>>>>>>>>>>>> Thanks
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> What is the type of resourceCreateEvent.getTarget() ?
>>>>>>>>>>>>>>>>>>> Is it WebSocketRequestHandler or AjaxRequestHandler ?
>>>>>>>>>>>>>>>>>> "resourceCreateEvent.getTarget()"type is
>>>>>>>>>>>>>>>>>> "AjaxRequestHandler".
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> [1]
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
>>>>>>>>>>>>>>>>>>>> On 21/02/19 10:01, Martin Grigorov wrote:
>>>>>>>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> Check the browser's Dev Tools' console for any
>>>>>>>>>>>>>>>>>>>>> JavaScript
>>>>>>>>>> errors.
>>>>>>>>>>>>>>>>>>>>> If there are no errors then check in the DevTools
>>>>>>>>>>>>>>>>>>>>> Network tab
>>>>>>>>>>>>>> whether
>>>>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>>>>>>> WebSocket response frame contains the JS code in its
>>>>>>>>>>>>>>>>>>>>> body. It
>>>>>>>>>>>> must
>>>>>>>>>>>>>> be
>>>>>>>>>>>>>>>>>>>>> inside <execution> XML element. If it is not there
>>>>>>>>>>>>>>>>>>>>> at all
>>>>>>>> then
>>>>>>>>>> it
>>>>>>>>>>>>>>>> must
>>>>>>>>>>>>>>>>>> be
>>>>>>>>>>>>>>>>>>>>> something on the server side.
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> On Thu, Feb 21, 2019 at 10:54 AM Matteo Alessandroni <
>>>>>>>>>>>>>>>>>>>> skylark17@apache.org>
>>>>>>>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> we have a logic where a websocket message is sent
>>>>>>>>>>>>>>>>>>>>>> from an
>>>>>>>>>>>>>>>> "onEvent()"
>>>>>>>>>>>>>>>>>>>>>> method [1] and catched in a WebSocketBehavior class
>>>>>>>>>>>>>>>>>>>>>> [2].
>>>>>>>>>>>>>>>>>>>>>> Then, a call to a js method "addEndpoint()"[3] must be
>>>>>>>>>> executed.
>>>>>>>>>>>>>>>>>>>>>> Our problem is that the js code "addEndpoint(...)"
>>>>>>>>>>>>>>>>>>>>>> inside
>>>>>>>>>>>>>>>>>>>>>> "handler.appendJavaScript(...)" [4] is not executed,
>>>>>>>>>>>>>>>>>>>>>> so the
>>>>>>>>>> code
>>>>>>>>>>>>>>>>>>>>>> correctly reaches that switch case but it's like the
>>>>>>>>>>>>>>>>>>>>>> "appendJavaScript(...)" is not working.
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> On our application v2.0.x that code works and it uses
>>>>>>>>>>>>>>>>>>>>>> Wicket
>>>>>>>>>>>> 7.x,
>>>>>>>>>>>>>>>>>> while
>>>>>>>>>>>>>>>>>>>>>> the newer v2.1.x  uses Wicket 8.x and it does not
>>>>>>>>>>>>>>>>>>>>>> work.
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> Could you please give us an hint of this? Is there
>>>>>>>>>>>>>>>>>>>>>> anything
>>>>>>>> we
>>>>>>>>>>>> are
>>>>>>>>>>>>>>>>>>>>>> missing to make it work for Wicket 8.x?
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> Thank you!
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> [1]
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
>>>>>>>>>>>>>>>>>>>>>> [2]
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L153-L157
>>>>>>>>>>>>>>>>>>>>>> [3]
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/resources/META-INF/resources/js/topology.js#L269-L280
>>>>>>>>>>>>>>>>>>>>>> [4]
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L154
>>>>>>>>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>>>>>>>>>>>>> <
>> http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>>
>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>
>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>
>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>
>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>
>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>>
>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>>
>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>
>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>
>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>
>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>
>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>
>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>
>>>>>>>> --
>>>>>>>>
>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>
>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>
>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>
>>>>>>>> http://www.tirasa.net
>>>>>>>>
>>>>>>>> Apache Syncope PMC Member
>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>
>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>
>>>>> --
>>>>>
>>>>> Dott. Matteo Alessandroni
>>>>>
>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>
>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>
>>>>> http://www.tirasa.net
>>>>>
>>>>> Apache Syncope PMC Member
>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>
>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>
>> --
>>
>> Dott. Matteo Alessandroni
>>
>> Software Engineer @ Tirasa S.r.l.
>>
>> Viale Vittoria Colonna, 97 - 65127 Pescara
>> Tel +39 0859116307 / FAX +39 0859111173
>>
>> http://www.tirasa.net
>>
>> Apache Syncope PMC Member
>> http://people.apache.org/phonebook.html?uid=skylark17
>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>
>> Tirasa S.r.l. <http://www.tirasa.net>
>>

-- 

Dott. Matteo Alessandroni

Software Engineer @ Tirasa S.r.l.

Viale Vittoria Colonna, 97 - 65127 Pescara
Tel +39 0859116307 / FAX +39 0859111173

http://www.tirasa.net

Apache Syncope PMC Member
http://people.apache.org/phonebook.html?uid=skylark17 
<http://people.apache.org/phonebook.html?uid=skylark17>

Tirasa S.r.l. <http://www.tirasa.net>

Re: WebSocketRequestHandler object not executing javascript code

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

I've explained you earlier where to look at.
WebSocketRequestHandler#respond() is not called for some reason.
It is scheduled in AbstractWebSocketProcessor with
requestCycle#scheduleAfterCurrent() but it seems later another
IRequestHandler is scheduled and replaced it.

If you can reproduce in a mini application I would be happy to debug it.

On Thu, Feb 28, 2019 at 3:51 PM Matteo Alessandroni <sk...@apache.org>
wrote:

>
>
> On 22/02/19 12:55, Matteo Alessandroni wrote:
> >
> >
> > On 22/02/19 12:46, Martin Grigorov wrote:
> >> On Fri, Feb 22, 2019 at 1:40 PM Matteo Alessandroni
> >> <sk...@apache.org>
> >> wrote:
> >>
> >>>
> >>> On 22/02/19 12:28, Matteo Alessandroni wrote:
> >>>>
> >>>> On 22/02/19 10:31, Martin Grigorov wrote:
> >>>>> On Fri, Feb 22, 2019 at 10:50 AM Matteo Alessandroni
> >>>>> <sk...@apache.org>
> >>>>> wrote:
> >>>>>
> >>>>>> On 21/02/19 18:50, Martin Grigorov wrote:
> >>>>>>> On Thu, Feb 21, 2019, 18:29 Matteo Alessandroni
> >>>>>>> <skylark17@apache.org
> >>>>>>> wrote:
> >>>>>>>
> >>>>>>>> On 21/02/19 16:43, Martin Grigorov wrote:
> >>>>>>>>> On Thu, Feb 21, 2019 at 5:35 PM Matteo Alessandroni <
> >>>>>>>> skylark17@apache.org>
> >>>>>>>>> wrote:
> >>>>>>>>>
> >>>>>>>>>> On 21/02/19 16:30, Martin Grigorov wrote:
> >>>>>>>>>>> On Thu, Feb 21, 2019 at 5:24 PM Matteo Alessandroni <
> >>>>>>>>>> skylark17@apache.org>
> >>>>>>>>>>> wrote:
> >>>>>>>>>>>
> >>>>>>>>>>>> On 21/02/19 16:07, Martin Grigorov wrote:
> >>>>>>>>>>>>> On Thu, Feb 21, 2019 at 4:41 PM Matteo Alessandroni <
> >>>>>>>>>>>> skylark17@apache.org>
> >>>>>>>>>>>>> wrote:
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>> On 21/02/19 12:14, Martin Grigorov wrote:
> >>>>>>>>>>>>>>> On Thu, Feb 21, 2019 at 12:11 PM Matteo Alessandroni <
> >>>>>>>>>>>>>>> matteo.alessandroni@tirasa.net> wrote:
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> Hi,
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> On 21/02/19 11:05, Martin Grigorov wrote:
> >>>>>>>>>>>>>>>>> When the WebSocket connection is established (maybe
> >>>>>>>>>>>>>>>>> when the
> >>>>>> page
> >>>>>>>>>> is
> >>>>>>>>>>>>>>>>> loaded) you should see an entry in the Network tab.
> >>>>>>>>>>>>>>>>> If you select this entry then on the right-side you
> >>>>>>>>>>>>>>>>> should see
> >>>>>>>> any
> >>>>>>>>>> WS
> >>>>>>>>>>>>>>>>> messages to/from the server.
> >>>>>>>>>>>>>>>> Yes I know how about WS debugging, but I do not see any WS
> >>>>>> request
> >>>>>>>>>>>> (with
> >>>>>>>>>>>>>>>> WS devtool filter and without it).
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> Maybe this is the problem.
> >>>>>>>>>>>>>>> If there is no WebSocket response at all then there is no
> >>>>>>>>>>>>>>> way the
> >>>>>>>> JS
> >>>>>>>>>>>> code
> >>>>>>>>>>>>>>> to be executed.
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> But since your WebSocketBehavior callback method is
> >>>>>>>>>>>>>>> executed then
> >>>>>>>>>> there
> >>>>>>>>>>>>>>> must be an established WebSocket connection.
> >>>>>>>>>>>>>>> I have no idea what goes wrong.
> >>>>>>>>>>>>>> It is strange because in our application version that uses
> >>>>>>>>>>>>>> Wicket
> >>>>>>>> 7.x
> >>>>>>>>>> I
> >>>>>>>>>>>>>> see no WS requests in DevTools console as well, but the
> >>>>>>>>>>>>>> code is
> >>>>>>>>>>>>>> correctly executed and everything works.
> >>>>>>>>>>>>>> Yes the WebSocket connection seems to be established
> >>>>>>>>>>>>>> anyway in
> >>>>>> both
> >>>>>>>>>> our
> >>>>>>>>>>>>>> versions so with both Wicket 7.x and 8.x, but for some
> >>>>>>>>>>>>>> reason the
> >>>>>>>>>>>>>> "appendJavaScript()" method does not work on the
> >>>>>>>>>>>>>> "WebSocketRequestHandler" object with Wicket 8.x.
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Is there anything else we can try to make it work?
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>> Put a breakpoint at
> >>>>>>>>>>>>>
> >>>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
> >>>
> >>>>>>>>>>>>> and see whether it is called.
> >>>>>>>>>>>>> And another one at
> >>>>>>>>>>>>>
> >>>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86
> >>>
> >>>>>>>>>>>>> to see whether the XML response is being written back to the
> >>>>>> browser
> >>>>>>>> in
> >>>>>>>>>>>> the
> >>>>>>>>>>>>> WebSocketConnection.
> >>>>>>>>>>>> Thanks!
> >>>>>>>>>>>> Ok the first method [1] was called many times and once was the
> >>>>>>>>>>>> one
> >>>>>> I'm
> >>>>>>>>>>>> interested on where the "script" variable was:
> >>>>>>>>>>>>
> >>>>>>>>>>>>
> >>>>>>>>>>>>
> >>>
> "window.Wicket.WebSocket.send('{"kind":"ADD_ENDPOINT","target":"...","source":"...","scope":"..."}');"
>
> >>>
> >>>
> >>>>>>>>>>>> also the second one [2] was called, but *only once* and
> >>>>>>>>>>>> both the
> >>>>>>>> "text"
> >>>>>>>>>>>> and "binary" variables were null.
> >>>>>>>>>>>>
> >>>>>>>>>>> What is the type of "response" variable at
> >>>>>>>>>>>
> >>>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
> >>>
> >>>>>>>>>>> ?
> >>>>>>>>>>> It seems it is not WebSocketResponse
> >>>>>>>>>> Ideed, it's "StringResponse"!
> >>>>>>>>>> And it's content is something like this:
> >>>>>>>>>>
> >>>>>>>>> I didn't expect this!
> >>>>>>>>> Can you please put a breakpoint
> >>>>>>>>> at org.apache.wicket.response.StringResponse#StringResponse()
> >>>>>>>>> (the
> >>>>>>>>> constructor) and see where it is instantiated.
> >>>>>>>>> AjaxRequestHandler uses StringResponse, but
> >>>>>>>>> WebSocketRequestHandler
> >>>>>> does
> >>>>>>>>> not.
> >>>>>>>> I'm not completely sure but it seems that all the times the
> >>>>>>>> application
> >>>>>>>> enters in [1] (including when "script" contains "addEnpoint(...)")
> >>>>>>>> and
> >>>>>>>> then the "StringResponse()" constructor is called, the source
> >>>>>>>> is [2].
> >>>>>>>>
> >>>>>>>> [1]
> >>>>>>>>
> >>>>>>>>
> >>>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
> >>>
> >>>>>>>> [2]
> >>>>>>>>
> >>>>>>>>
> >>>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestHandler.java#L360
> >>>
> >>>>>>> It seems WebSocketRequestHandler#respond() is not called at all.
> >>>>>>> Put a breakpoint in AbstractWebSocketProcessor and see what happens
> >>>>>> there.
> >>>>>>
> >>>>>> Hi,
> >>>>>> ok thanks, I did that and the constructor of
> >>>>>> "AbstractWebSocketProcessor" is never called!
> >>>>>>
> >>>>> The constructor should be called when the WS connection is
> >>>>> established.
> >>>>> I guess you use wicket-native-websocket-javax.
> >>>>> Check org.apache.wicket.protocol.ws.javax.JavaxWebSocketProcessor
> and
> >>>>> its
> >>>>> org.apache.wicket.protocol.ws
> >>> .javax.JavaxWebSocketProcessor.StringMessageHandler
> >>>>> onMessage() method is called when the client sends something to the
> >>>>> server.
> >>>>> onMessage() delegates
> >>>>> to
> >>>>> org.apache.wicket.protocol.ws
> >>> .api.AbstractWebSocketProcessor#broadcastMessage()
> >>>>> where the processing happens, i.e. WebSocketBehavior#onMessage() is
> >>>>> called.
> >>>> Yes we use "wicket-native-websocket-javax" [1].
> >>>> What I have just done is putting a breackpoint in both that method
> >>>> from
> >>>>
> >>>
> "org.apache.wicket.protocol.ws.javax.JavaxWebSocketProcessor#StringMessageHandler
>
> >>>
> >>>> onMessage()" and
> >>>>
> >>>
> "org.apache.wicket.protocol.ws.api.AbstractWebSocketProcessor#broadcastMessage()",
>
> >>>
> >>>
> >>>> but it does *not* enter there either.
> >>>>
> >>>> So at that point I have tried to start v2.0.x with Wicket 7.x and
> >>>> tried to debug the same way, the result is that it enters in [2] only.
> >>>>
> >>>>
> >>>> [1]
> >>>>
> https://github.com/apache/syncope/blob/2_1_X/client/console/pom.xml#L83
> >>>>
> >>>> [2]
> >>>>
> >>>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/JavaxWebSocketProcessor.java#L65
> >>>
> >>>
> >>> Sorry I correct myself, I tried again with 2.1.x (Wicket 8.x) and it
> >>> entered in [1] and [2].
> >>>
> >>> [1]
> >>>
> >>>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/JavaxWebSocketProcessor.java#L65
> >>>
> >>>
> >>> [2]
> >>>
> >>>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketProcessor.java#L213
> >>>
> >>
> >> Once the debugger is here set another breakpoint at
> >>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java#L840
> >>
> >> and
> >>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java#L871
> >>
> >>
> >> it seems something removes WebSocketRequestHandler from the pipeline and
> >> that's why its #respond() method is not executed.
> >
> > Ok, it enters just a couple of times in [1] right after [2] and [3].
> >
> > [1]
> >
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java#L840
> > [2]
> >
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/JavaxWebSocketProcessor.java#L65
> > [3]
> >
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketProcessor.java#L213
>
>
> Hi Grigorov,
>
> is there anything else I can do for this?
> Is there a chance you reproduced it?
>
> Thanks!
>
>
> >
> >>
> >>>
> >>>>>
> >>>>>>>
> >>>>>>>>>> <?xml version="1.0" encoding="UTF-8"?><ajax-response><component
> >>>>>>>>>> id="id178" ><![CDATA[<span id="id178">
> >>>>>>>>>> <div class="wizard-form">
> >>>>>>>>>> <div id="id204">
> >>>>>>>>>> <div class="wizard-overview">
> >>>>>>>>>>
> >>>>>>>>>> </div>
> >>>>>>>>>> <div class="wizard-header">
> >>>>>>>>>> <div>
> >>>>>>>>>> <div>
> >>>>>>>>>> <div class="wizard-step-title">
> >>>>>>>>>> <div></div>
> >>>>>>>>>> </div>
> >>>>>>>>>> <div class="wizard-step-summary">
> >>>>>>>>>> <div></div>
> >>>>>>>>>> </div>
> >>>>>>>>>> </div>
> >>>>>>>>>> </div>
> >>>>>>>>>> </div>
> >>>>>>>>>> <div class="wizard-view">
> >>>>>>>>>> <div id="id207">
> >>>>>>>>>> <span id="id226">
> >>>>>>>>>> <span id="id227">
> >>>>>>>>>>
> >>>>>>>>>> ...
> >>>>>>>>>>
> >>>>>>>>>>>> [1]
> >>>>>>>>>>>>
> >>>>>>>>>>>>
> >>>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
> >>>
> >>>>>>>>>>>> [2]
> >>>>>>>>>>>>
> >>>>>>>>>>>>
> >>>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86
> >>>
> >>>>>>>>>>>>>> Thanks
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> What is the type of resourceCreateEvent.getTarget() ?
> >>>>>>>>>>>>>>>>> Is it WebSocketRequestHandler or AjaxRequestHandler ?
> >>>>>>>>>>>>>>>> "resourceCreateEvent.getTarget()"type is
> >>>>>>>>>>>>>>>> "AjaxRequestHandler".
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> [1]
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>
> >>>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
> >>>
> >>>>>>>>>>>>>>>>>> On 21/02/19 10:01, Martin Grigorov wrote:
> >>>>>>>>>>>>>>>>>>> Hi,
> >>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>> Check the browser's Dev Tools' console for any
> >>>>>>>>>>>>>>>>>>> JavaScript
> >>>>>>>> errors.
> >>>>>>>>>>>>>>>>>>> If there are no errors then check in the DevTools
> >>>>>>>>>>>>>>>>>>> Network tab
> >>>>>>>>>>>> whether
> >>>>>>>>>>>>>>>> the
> >>>>>>>>>>>>>>>>>>> WebSocket response frame contains the JS code in its
> >>>>>>>>>>>>>>>>>>> body. It
> >>>>>>>>>> must
> >>>>>>>>>>>> be
> >>>>>>>>>>>>>>>>>>> inside <execution> XML element. If it is not there
> >>>>>>>>>>>>>>>>>>> at all
> >>>>>> then
> >>>>>>>> it
> >>>>>>>>>>>>>> must
> >>>>>>>>>>>>>>>> be
> >>>>>>>>>>>>>>>>>>> something on the server side.
> >>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>> On Thu, Feb 21, 2019 at 10:54 AM Matteo Alessandroni <
> >>>>>>>>>>>>>>>>>> skylark17@apache.org>
> >>>>>>>>>>>>>>>>>>> wrote:
> >>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>> Hi,
> >>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>> we have a logic where a websocket message is sent
> >>>>>>>>>>>>>>>>>>>> from an
> >>>>>>>>>>>>>> "onEvent()"
> >>>>>>>>>>>>>>>>>>>> method [1] and catched in a WebSocketBehavior class
> >>>>>>>>>>>>>>>>>>>> [2].
> >>>>>>>>>>>>>>>>>>>> Then, a call to a js method "addEndpoint()"[3] must be
> >>>>>>>> executed.
> >>>>>>>>>>>>>>>>>>>> Our problem is that the js code "addEndpoint(...)"
> >>>>>>>>>>>>>>>>>>>> inside
> >>>>>>>>>>>>>>>>>>>> "handler.appendJavaScript(...)" [4] is not executed,
> >>>>>>>>>>>>>>>>>>>> so the
> >>>>>>>> code
> >>>>>>>>>>>>>>>>>>>> correctly reaches that switch case but it's like the
> >>>>>>>>>>>>>>>>>>>> "appendJavaScript(...)" is not working.
> >>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>> On our application v2.0.x that code works and it uses
> >>>>>>>>>>>>>>>>>>>> Wicket
> >>>>>>>>>> 7.x,
> >>>>>>>>>>>>>>>> while
> >>>>>>>>>>>>>>>>>>>> the newer v2.1.x  uses Wicket 8.x and it does not
> >>>>>>>>>>>>>>>>>>>> work.
> >>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>> Could you please give us an hint of this? Is there
> >>>>>>>>>>>>>>>>>>>> anything
> >>>>>> we
> >>>>>>>>>> are
> >>>>>>>>>>>>>>>>>>>> missing to make it work for Wicket 8.x?
> >>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>> Thank you!
> >>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>> [1]
> >>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>>
> >>>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
> >>>
> >>>>>>>>>>>>>>>>>>>> [2]
> >>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>>
> >>>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L153-L157
> >>>
> >>>>>>>>>>>>>>>>>>>> [3]
> >>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>>
> >>>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/resources/META-INF/resources/js/topology.js#L269-L280
> >>>
> >>>>>>>>>>>>>>>>>>>> [4]
> >>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>>
> >>>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L154
> >>>
> >>>>>>>>>>>>>>>>>>>> --
> >>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>> Dott. Matteo Alessandroni
> >>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>>>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>> http://www.tirasa.net
> >>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>> Apache Syncope PMC Member
> >>>>>>>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>>>>>>>>>>>>>>>> <
> http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> --
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> Dott. Matteo Alessandroni
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> http://www.tirasa.net
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> Apache Syncope PMC Member
> >>>>>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> --
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> Dott. Matteo Alessandroni
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> http://www.tirasa.net
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> Apache Syncope PMC Member
> >>>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>> --
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Dott. Matteo Alessandroni
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> http://www.tirasa.net
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Apache Syncope PMC Member
> >>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>>>>>>>>>
> >>>>>>>>>>>> --
> >>>>>>>>>>>>
> >>>>>>>>>>>> Dott. Matteo Alessandroni
> >>>>>>>>>>>>
> >>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>>>>>>>
> >>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>>>>>>>
> >>>>>>>>>>>> http://www.tirasa.net
> >>>>>>>>>>>>
> >>>>>>>>>>>> Apache Syncope PMC Member
> >>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>>>>>>>
> >>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>>>>>>>
> >>>>>>>>>> --
> >>>>>>>>>>
> >>>>>>>>>> Dott. Matteo Alessandroni
> >>>>>>>>>>
> >>>>>>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>>>>>
> >>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>>>>>
> >>>>>>>>>> http://www.tirasa.net
> >>>>>>>>>>
> >>>>>>>>>> Apache Syncope PMC Member
> >>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>>>>>
> >>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>>>>>
> >>>>>>>> --
> >>>>>>>>
> >>>>>>>> Dott. Matteo Alessandroni
> >>>>>>>>
> >>>>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>>>
> >>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>>>
> >>>>>>>> http://www.tirasa.net
> >>>>>>>>
> >>>>>>>> Apache Syncope PMC Member
> >>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>>>
> >>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>>>
> >>>>>> --
> >>>>>>
> >>>>>> Dott. Matteo Alessandroni
> >>>>>>
> >>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>
> >>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>
> >>>>>> http://www.tirasa.net
> >>>>>>
> >>>>>> Apache Syncope PMC Member
> >>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>
> >>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>
> >>> --
> >>>
> >>> Dott. Matteo Alessandroni
> >>>
> >>> Software Engineer @ Tirasa S.r.l.
> >>>
> >>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>> Tel +39 0859116307 / FAX +39 0859111173
> >>>
> >>> http://www.tirasa.net
> >>>
> >>> Apache Syncope PMC Member
> >>> http://people.apache.org/phonebook.html?uid=skylark17
> >>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>
> >>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>
> >
>
> --
>
> Dott. Matteo Alessandroni
>
> Software Engineer @ Tirasa S.r.l.
>
> Viale Vittoria Colonna, 97 - 65127 Pescara
> Tel +39 0859116307 / FAX +39 0859111173
>
> http://www.tirasa.net
>
> Apache Syncope PMC Member
> http://people.apache.org/phonebook.html?uid=skylark17
> <http://people.apache.org/phonebook.html?uid=skylark17>
>
> Tirasa S.r.l. <http://www.tirasa.net>
>

Re: WebSocketRequestHandler object not executing javascript code

Posted by Matteo Alessandroni <sk...@apache.org>.

On 22/02/19 12:55, Matteo Alessandroni wrote:
>
>
> On 22/02/19 12:46, Martin Grigorov wrote:
>> On Fri, Feb 22, 2019 at 1:40 PM Matteo Alessandroni 
>> <sk...@apache.org>
>> wrote:
>>
>>>
>>> On 22/02/19 12:28, Matteo Alessandroni wrote:
>>>>
>>>> On 22/02/19 10:31, Martin Grigorov wrote:
>>>>> On Fri, Feb 22, 2019 at 10:50 AM Matteo Alessandroni
>>>>> <sk...@apache.org>
>>>>> wrote:
>>>>>
>>>>>> On 21/02/19 18:50, Martin Grigorov wrote:
>>>>>>> On Thu, Feb 21, 2019, 18:29 Matteo Alessandroni 
>>>>>>> <skylark17@apache.org
>>>>>>> wrote:
>>>>>>>
>>>>>>>> On 21/02/19 16:43, Martin Grigorov wrote:
>>>>>>>>> On Thu, Feb 21, 2019 at 5:35 PM Matteo Alessandroni <
>>>>>>>> skylark17@apache.org>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> On 21/02/19 16:30, Martin Grigorov wrote:
>>>>>>>>>>> On Thu, Feb 21, 2019 at 5:24 PM Matteo Alessandroni <
>>>>>>>>>> skylark17@apache.org>
>>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> On 21/02/19 16:07, Martin Grigorov wrote:
>>>>>>>>>>>>> On Thu, Feb 21, 2019 at 4:41 PM Matteo Alessandroni <
>>>>>>>>>>>> skylark17@apache.org>
>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>> On 21/02/19 12:14, Martin Grigorov wrote:
>>>>>>>>>>>>>>> On Thu, Feb 21, 2019 at 12:11 PM Matteo Alessandroni <
>>>>>>>>>>>>>>> matteo.alessandroni@tirasa.net> wrote:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> On 21/02/19 11:05, Martin Grigorov wrote:
>>>>>>>>>>>>>>>>> When the WebSocket connection is established (maybe 
>>>>>>>>>>>>>>>>> when the
>>>>>> page
>>>>>>>>>> is
>>>>>>>>>>>>>>>>> loaded) you should see an entry in the Network tab.
>>>>>>>>>>>>>>>>> If you select this entry then on the right-side you
>>>>>>>>>>>>>>>>> should see
>>>>>>>> any
>>>>>>>>>> WS
>>>>>>>>>>>>>>>>> messages to/from the server.
>>>>>>>>>>>>>>>> Yes I know how about WS debugging, but I do not see any WS
>>>>>> request
>>>>>>>>>>>> (with
>>>>>>>>>>>>>>>> WS devtool filter and without it).
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Maybe this is the problem.
>>>>>>>>>>>>>>> If there is no WebSocket response at all then there is no
>>>>>>>>>>>>>>> way the
>>>>>>>> JS
>>>>>>>>>>>> code
>>>>>>>>>>>>>>> to be executed.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> But since your WebSocketBehavior callback method is
>>>>>>>>>>>>>>> executed then
>>>>>>>>>> there
>>>>>>>>>>>>>>> must be an established WebSocket connection.
>>>>>>>>>>>>>>> I have no idea what goes wrong.
>>>>>>>>>>>>>> It is strange because in our application version that uses
>>>>>>>>>>>>>> Wicket
>>>>>>>> 7.x
>>>>>>>>>> I
>>>>>>>>>>>>>> see no WS requests in DevTools console as well, but the 
>>>>>>>>>>>>>> code is
>>>>>>>>>>>>>> correctly executed and everything works.
>>>>>>>>>>>>>> Yes the WebSocket connection seems to be established 
>>>>>>>>>>>>>> anyway in
>>>>>> both
>>>>>>>>>> our
>>>>>>>>>>>>>> versions so with both Wicket 7.x and 8.x, but for some
>>>>>>>>>>>>>> reason the
>>>>>>>>>>>>>> "appendJavaScript()" method does not work on the
>>>>>>>>>>>>>> "WebSocketRequestHandler" object with Wicket 8.x.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Is there anything else we can try to make it work?
>>>>>>>>>>>>>>
>>>>>>>>>>>>> Put a breakpoint at
>>>>>>>>>>>>>
>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141 
>>>
>>>>>>>>>>>>> and see whether it is called.
>>>>>>>>>>>>> And another one at
>>>>>>>>>>>>>
>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86 
>>>
>>>>>>>>>>>>> to see whether the XML response is being written back to the
>>>>>> browser
>>>>>>>> in
>>>>>>>>>>>> the
>>>>>>>>>>>>> WebSocketConnection.
>>>>>>>>>>>> Thanks!
>>>>>>>>>>>> Ok the first method [1] was called many times and once was the
>>>>>>>>>>>> one
>>>>>> I'm
>>>>>>>>>>>> interested on where the "script" variable was:
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>> "window.Wicket.WebSocket.send('{"kind":"ADD_ENDPOINT","target":"...","source":"...","scope":"..."}');" 
>>>
>>>
>>>>>>>>>>>> also the second one [2] was called, but *only once* and 
>>>>>>>>>>>> both the
>>>>>>>> "text"
>>>>>>>>>>>> and "binary" variables were null.
>>>>>>>>>>>>
>>>>>>>>>>> What is the type of "response" variable at
>>>>>>>>>>>
>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141 
>>>
>>>>>>>>>>> ?
>>>>>>>>>>> It seems it is not WebSocketResponse
>>>>>>>>>> Ideed, it's "StringResponse"!
>>>>>>>>>> And it's content is something like this:
>>>>>>>>>>
>>>>>>>>> I didn't expect this!
>>>>>>>>> Can you please put a breakpoint
>>>>>>>>> at org.apache.wicket.response.StringResponse#StringResponse() 
>>>>>>>>> (the
>>>>>>>>> constructor) and see where it is instantiated.
>>>>>>>>> AjaxRequestHandler uses StringResponse, but 
>>>>>>>>> WebSocketRequestHandler
>>>>>> does
>>>>>>>>> not.
>>>>>>>> I'm not completely sure but it seems that all the times the
>>>>>>>> application
>>>>>>>> enters in [1] (including when "script" contains "addEnpoint(...)")
>>>>>>>> and
>>>>>>>> then the "StringResponse()" constructor is called, the source 
>>>>>>>> is [2].
>>>>>>>>
>>>>>>>> [1]
>>>>>>>>
>>>>>>>>
>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141 
>>>
>>>>>>>> [2]
>>>>>>>>
>>>>>>>>
>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestHandler.java#L360 
>>>
>>>>>>> It seems WebSocketRequestHandler#respond() is not called at all.
>>>>>>> Put a breakpoint in AbstractWebSocketProcessor and see what happens
>>>>>> there.
>>>>>>
>>>>>> Hi,
>>>>>> ok thanks, I did that and the constructor of
>>>>>> "AbstractWebSocketProcessor" is never called!
>>>>>>
>>>>> The constructor should be called when the WS connection is 
>>>>> established.
>>>>> I guess you use wicket-native-websocket-javax.
>>>>> Check org.apache.wicket.protocol.ws.javax.JavaxWebSocketProcessor and
>>>>> its
>>>>> org.apache.wicket.protocol.ws
>>> .javax.JavaxWebSocketProcessor.StringMessageHandler
>>>>> onMessage() method is called when the client sends something to the
>>>>> server.
>>>>> onMessage() delegates
>>>>> to
>>>>> org.apache.wicket.protocol.ws
>>> .api.AbstractWebSocketProcessor#broadcastMessage()
>>>>> where the processing happens, i.e. WebSocketBehavior#onMessage() is
>>>>> called.
>>>> Yes we use "wicket-native-websocket-javax" [1].
>>>> What I have just done is putting a breackpoint in both that method
>>>> from
>>>>
>>> "org.apache.wicket.protocol.ws.javax.JavaxWebSocketProcessor#StringMessageHandler 
>>>
>>>> onMessage()" and
>>>>
>>> "org.apache.wicket.protocol.ws.api.AbstractWebSocketProcessor#broadcastMessage()", 
>>>
>>>
>>>> but it does *not* enter there either.
>>>>
>>>> So at that point I have tried to start v2.0.x with Wicket 7.x and
>>>> tried to debug the same way, the result is that it enters in [2] only.
>>>>
>>>>
>>>> [1]
>>>> https://github.com/apache/syncope/blob/2_1_X/client/console/pom.xml#L83 
>>>>
>>>> [2]
>>>>
>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/JavaxWebSocketProcessor.java#L65 
>>>
>>>
>>> Sorry I correct myself, I tried again with 2.1.x (Wicket 8.x) and it
>>> entered in [1] and [2].
>>>
>>> [1]
>>>
>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/JavaxWebSocketProcessor.java#L65 
>>>
>>>
>>> [2]
>>>
>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketProcessor.java#L213 
>>>
>>
>> Once the debugger is here set another breakpoint at
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java#L840 
>>
>> and
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java#L871 
>>
>>
>> it seems something removes WebSocketRequestHandler from the pipeline and
>> that's why its #respond() method is not executed.
>
> Ok, it enters just a couple of times in [1] right after [2] and [3].
>
> [1] 
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java#L840
> [2] 
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/JavaxWebSocketProcessor.java#L65
> [3] 
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketProcessor.java#L213


Hi Grigorov,

is there anything else I can do for this?
Is there a chance you reproduced it?

Thanks!


>
>>
>>>
>>>>>
>>>>>>>
>>>>>>>>>> <?xml version="1.0" encoding="UTF-8"?><ajax-response><component
>>>>>>>>>> id="id178" ><![CDATA[<span id="id178">
>>>>>>>>>> <div class="wizard-form">
>>>>>>>>>> <div id="id204">
>>>>>>>>>> <div class="wizard-overview">
>>>>>>>>>>
>>>>>>>>>> </div>
>>>>>>>>>> <div class="wizard-header">
>>>>>>>>>> <div>
>>>>>>>>>> <div>
>>>>>>>>>> <div class="wizard-step-title">
>>>>>>>>>> <div></div>
>>>>>>>>>> </div>
>>>>>>>>>> <div class="wizard-step-summary">
>>>>>>>>>> <div></div>
>>>>>>>>>> </div>
>>>>>>>>>> </div>
>>>>>>>>>> </div>
>>>>>>>>>> </div>
>>>>>>>>>> <div class="wizard-view">
>>>>>>>>>> <div id="id207">
>>>>>>>>>> <span id="id226">
>>>>>>>>>> <span id="id227">
>>>>>>>>>>
>>>>>>>>>> ...
>>>>>>>>>>
>>>>>>>>>>>> [1]
>>>>>>>>>>>>
>>>>>>>>>>>>
>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141 
>>>
>>>>>>>>>>>> [2]
>>>>>>>>>>>>
>>>>>>>>>>>>
>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86 
>>>
>>>>>>>>>>>>>> Thanks
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> What is the type of resourceCreateEvent.getTarget() ?
>>>>>>>>>>>>>>>>> Is it WebSocketRequestHandler or AjaxRequestHandler ?
>>>>>>>>>>>>>>>> "resourceCreateEvent.getTarget()"type is
>>>>>>>>>>>>>>>> "AjaxRequestHandler".
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> [1]
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609 
>>>
>>>>>>>>>>>>>>>>>> On 21/02/19 10:01, Martin Grigorov wrote:
>>>>>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Check the browser's Dev Tools' console for any 
>>>>>>>>>>>>>>>>>>> JavaScript
>>>>>>>> errors.
>>>>>>>>>>>>>>>>>>> If there are no errors then check in the DevTools
>>>>>>>>>>>>>>>>>>> Network tab
>>>>>>>>>>>> whether
>>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>>>>> WebSocket response frame contains the JS code in its
>>>>>>>>>>>>>>>>>>> body. It
>>>>>>>>>> must
>>>>>>>>>>>> be
>>>>>>>>>>>>>>>>>>> inside <execution> XML element. If it is not there 
>>>>>>>>>>>>>>>>>>> at all
>>>>>> then
>>>>>>>> it
>>>>>>>>>>>>>> must
>>>>>>>>>>>>>>>> be
>>>>>>>>>>>>>>>>>>> something on the server side.
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> On Thu, Feb 21, 2019 at 10:54 AM Matteo Alessandroni <
>>>>>>>>>>>>>>>>>> skylark17@apache.org>
>>>>>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> we have a logic where a websocket message is sent 
>>>>>>>>>>>>>>>>>>>> from an
>>>>>>>>>>>>>> "onEvent()"
>>>>>>>>>>>>>>>>>>>> method [1] and catched in a WebSocketBehavior class 
>>>>>>>>>>>>>>>>>>>> [2].
>>>>>>>>>>>>>>>>>>>> Then, a call to a js method "addEndpoint()"[3] must be
>>>>>>>> executed.
>>>>>>>>>>>>>>>>>>>> Our problem is that the js code "addEndpoint(...)" 
>>>>>>>>>>>>>>>>>>>> inside
>>>>>>>>>>>>>>>>>>>> "handler.appendJavaScript(...)" [4] is not executed,
>>>>>>>>>>>>>>>>>>>> so the
>>>>>>>> code
>>>>>>>>>>>>>>>>>>>> correctly reaches that switch case but it's like the
>>>>>>>>>>>>>>>>>>>> "appendJavaScript(...)" is not working.
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> On our application v2.0.x that code works and it uses
>>>>>>>>>>>>>>>>>>>> Wicket
>>>>>>>>>> 7.x,
>>>>>>>>>>>>>>>> while
>>>>>>>>>>>>>>>>>>>> the newer v2.1.x  uses Wicket 8.x and it does not 
>>>>>>>>>>>>>>>>>>>> work.
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Could you please give us an hint of this? Is there
>>>>>>>>>>>>>>>>>>>> anything
>>>>>> we
>>>>>>>>>> are
>>>>>>>>>>>>>>>>>>>> missing to make it work for Wicket 8.x?
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Thank you!
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> [1]
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609 
>>>
>>>>>>>>>>>>>>>>>>>> [2]
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L153-L157 
>>>
>>>>>>>>>>>>>>>>>>>> [3]
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/resources/META-INF/resources/js/topology.js#L269-L280 
>>>
>>>>>>>>>>>>>>>>>>>> [4]
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L154 
>>>
>>>>>>>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17> 
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>>>
>>>>>>>>>>>> -- 
>>>>>>>>>>>>
>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>
>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>
>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>
>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>
>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>>
>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>
>>>>>>>>>> -- 
>>>>>>>>>>
>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>
>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>
>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>
>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>
>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>
>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>
>>>>>>>> -- 
>>>>>>>>
>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>
>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>
>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>
>>>>>>>> http://www.tirasa.net
>>>>>>>>
>>>>>>>> Apache Syncope PMC Member
>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>
>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>
>>>>>> -- 
>>>>>>
>>>>>> Dott. Matteo Alessandroni
>>>>>>
>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>
>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>
>>>>>> http://www.tirasa.net
>>>>>>
>>>>>> Apache Syncope PMC Member
>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>
>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>
>>> -- 
>>>
>>> Dott. Matteo Alessandroni
>>>
>>> Software Engineer @ Tirasa S.r.l.
>>>
>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>> Tel +39 0859116307 / FAX +39 0859111173
>>>
>>> http://www.tirasa.net
>>>
>>> Apache Syncope PMC Member
>>> http://people.apache.org/phonebook.html?uid=skylark17
>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>
>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>
>

-- 

Dott. Matteo Alessandroni

Software Engineer @ Tirasa S.r.l.

Viale Vittoria Colonna, 97 - 65127 Pescara
Tel +39 0859116307 / FAX +39 0859111173

http://www.tirasa.net

Apache Syncope PMC Member
http://people.apache.org/phonebook.html?uid=skylark17 
<http://people.apache.org/phonebook.html?uid=skylark17>

Tirasa S.r.l. <http://www.tirasa.net>

Re: WebSocketRequestHandler object not executing javascript code

Posted by Matteo Alessandroni <sk...@apache.org>.

On 22/02/19 12:46, Martin Grigorov wrote:
> On Fri, Feb 22, 2019 at 1:40 PM Matteo Alessandroni <sk...@apache.org>
> wrote:
>
>>
>> On 22/02/19 12:28, Matteo Alessandroni wrote:
>>>
>>> On 22/02/19 10:31, Martin Grigorov wrote:
>>>> On Fri, Feb 22, 2019 at 10:50 AM Matteo Alessandroni
>>>> <sk...@apache.org>
>>>> wrote:
>>>>
>>>>> On 21/02/19 18:50, Martin Grigorov wrote:
>>>>>> On Thu, Feb 21, 2019, 18:29 Matteo Alessandroni <skylark17@apache.org
>>>>>> wrote:
>>>>>>
>>>>>>> On 21/02/19 16:43, Martin Grigorov wrote:
>>>>>>>> On Thu, Feb 21, 2019 at 5:35 PM Matteo Alessandroni <
>>>>>>> skylark17@apache.org>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> On 21/02/19 16:30, Martin Grigorov wrote:
>>>>>>>>>> On Thu, Feb 21, 2019 at 5:24 PM Matteo Alessandroni <
>>>>>>>>> skylark17@apache.org>
>>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>>> On 21/02/19 16:07, Martin Grigorov wrote:
>>>>>>>>>>>> On Thu, Feb 21, 2019 at 4:41 PM Matteo Alessandroni <
>>>>>>>>>>> skylark17@apache.org>
>>>>>>>>>>>> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> On 21/02/19 12:14, Martin Grigorov wrote:
>>>>>>>>>>>>>> On Thu, Feb 21, 2019 at 12:11 PM Matteo Alessandroni <
>>>>>>>>>>>>>> matteo.alessandroni@tirasa.net> wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On 21/02/19 11:05, Martin Grigorov wrote:
>>>>>>>>>>>>>>>> When the WebSocket connection is established (maybe when the
>>>>> page
>>>>>>>>> is
>>>>>>>>>>>>>>>> loaded) you should see an entry in the Network tab.
>>>>>>>>>>>>>>>> If you select this entry then on the right-side you
>>>>>>>>>>>>>>>> should see
>>>>>>> any
>>>>>>>>> WS
>>>>>>>>>>>>>>>> messages to/from the server.
>>>>>>>>>>>>>>> Yes I know how about WS debugging, but I do not see any WS
>>>>> request
>>>>>>>>>>> (with
>>>>>>>>>>>>>>> WS devtool filter and without it).
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Maybe this is the problem.
>>>>>>>>>>>>>> If there is no WebSocket response at all then there is no
>>>>>>>>>>>>>> way the
>>>>>>> JS
>>>>>>>>>>> code
>>>>>>>>>>>>>> to be executed.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> But since your WebSocketBehavior callback method is
>>>>>>>>>>>>>> executed then
>>>>>>>>> there
>>>>>>>>>>>>>> must be an established WebSocket connection.
>>>>>>>>>>>>>> I have no idea what goes wrong.
>>>>>>>>>>>>> It is strange because in our application version that uses
>>>>>>>>>>>>> Wicket
>>>>>>> 7.x
>>>>>>>>> I
>>>>>>>>>>>>> see no WS requests in DevTools console as well, but the code is
>>>>>>>>>>>>> correctly executed and everything works.
>>>>>>>>>>>>> Yes the WebSocket connection seems to be established anyway in
>>>>> both
>>>>>>>>> our
>>>>>>>>>>>>> versions so with both Wicket 7.x and 8.x, but for some
>>>>>>>>>>>>> reason the
>>>>>>>>>>>>> "appendJavaScript()" method does not work on the
>>>>>>>>>>>>> "WebSocketRequestHandler" object with Wicket 8.x.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Is there anything else we can try to make it work?
>>>>>>>>>>>>>
>>>>>>>>>>>> Put a breakpoint at
>>>>>>>>>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
>>>>>>>>>>>> and see whether it is called.
>>>>>>>>>>>> And another one at
>>>>>>>>>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86
>>>>>>>>>>>> to see whether the XML response is being written back to the
>>>>> browser
>>>>>>> in
>>>>>>>>>>> the
>>>>>>>>>>>> WebSocketConnection.
>>>>>>>>>>> Thanks!
>>>>>>>>>>> Ok the first method [1] was called many times and once was the
>>>>>>>>>>> one
>>>>> I'm
>>>>>>>>>>> interested on where the "script" variable was:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>> "window.Wicket.WebSocket.send('{"kind":"ADD_ENDPOINT","target":"...","source":"...","scope":"..."}');"
>>
>>>>>>>>>>> also the second one [2] was called, but *only once* and both the
>>>>>>> "text"
>>>>>>>>>>> and "binary" variables were null.
>>>>>>>>>>>
>>>>>>>>>> What is the type of "response" variable at
>>>>>>>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
>>>>>>>>>> ?
>>>>>>>>>> It seems it is not WebSocketResponse
>>>>>>>>> Ideed, it's "StringResponse"!
>>>>>>>>> And it's content is something like this:
>>>>>>>>>
>>>>>>>> I didn't expect this!
>>>>>>>> Can you please put a breakpoint
>>>>>>>> at org.apache.wicket.response.StringResponse#StringResponse() (the
>>>>>>>> constructor) and see where it is instantiated.
>>>>>>>> AjaxRequestHandler uses StringResponse, but WebSocketRequestHandler
>>>>> does
>>>>>>>> not.
>>>>>>> I'm not completely sure but it seems that all the times the
>>>>>>> application
>>>>>>> enters in [1] (including when "script" contains "addEnpoint(...)")
>>>>>>> and
>>>>>>> then the "StringResponse()" constructor is called, the source is [2].
>>>>>>>
>>>>>>> [1]
>>>>>>>
>>>>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
>>>>>>> [2]
>>>>>>>
>>>>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestHandler.java#L360
>>>>>> It seems WebSocketRequestHandler#respond() is not called at all.
>>>>>> Put a breakpoint in AbstractWebSocketProcessor and see what happens
>>>>> there.
>>>>>
>>>>> Hi,
>>>>> ok thanks, I did that and the constructor of
>>>>> "AbstractWebSocketProcessor" is never called!
>>>>>
>>>> The constructor should be called when the WS connection is established.
>>>> I guess you use wicket-native-websocket-javax.
>>>> Check org.apache.wicket.protocol.ws.javax.JavaxWebSocketProcessor and
>>>> its
>>>> org.apache.wicket.protocol.ws
>> .javax.JavaxWebSocketProcessor.StringMessageHandler
>>>> onMessage() method is called when the client sends something to the
>>>> server.
>>>> onMessage() delegates
>>>> to
>>>> org.apache.wicket.protocol.ws
>> .api.AbstractWebSocketProcessor#broadcastMessage()
>>>> where the processing happens, i.e. WebSocketBehavior#onMessage() is
>>>> called.
>>> Yes we use "wicket-native-websocket-javax" [1].
>>> What I have just done is putting a breackpoint in both that method
>>> from
>>>
>> "org.apache.wicket.protocol.ws.javax.JavaxWebSocketProcessor#StringMessageHandler
>>> onMessage()" and
>>>
>> "org.apache.wicket.protocol.ws.api.AbstractWebSocketProcessor#broadcastMessage()",
>>
>>> but it does *not* enter there either.
>>>
>>> So at that point I have tried to start v2.0.x with Wicket 7.x and
>>> tried to debug the same way, the result is that it enters in [2] only.
>>>
>>>
>>> [1]
>>> https://github.com/apache/syncope/blob/2_1_X/client/console/pom.xml#L83
>>> [2]
>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/JavaxWebSocketProcessor.java#L65
>>
>> Sorry I correct myself, I tried again with 2.1.x (Wicket 8.x) and it
>> entered in [1] and [2].
>>
>> [1]
>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/JavaxWebSocketProcessor.java#L65
>>
>> [2]
>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketProcessor.java#L213
>
> Once the debugger is here set another breakpoint at
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java#L840
> and
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java#L871
>
> it seems something removes WebSocketRequestHandler from the pipeline and
> that's why its #respond() method is not executed.

Ok, it enters just a couple of times in [1] right after [2] and [3].

[1] 
https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java#L840
[2] 
https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/JavaxWebSocketProcessor.java#L65
[3] 
https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketProcessor.java#L213

>
>>
>>>>
>>>>>>
>>>>>>>>> <?xml version="1.0" encoding="UTF-8"?><ajax-response><component
>>>>>>>>> id="id178" ><![CDATA[<span id="id178">
>>>>>>>>> <div class="wizard-form">
>>>>>>>>> <div id="id204">
>>>>>>>>> <div class="wizard-overview">
>>>>>>>>>
>>>>>>>>> </div>
>>>>>>>>> <div class="wizard-header">
>>>>>>>>> <div>
>>>>>>>>> <div>
>>>>>>>>> <div class="wizard-step-title">
>>>>>>>>> <div></div>
>>>>>>>>> </div>
>>>>>>>>> <div class="wizard-step-summary">
>>>>>>>>> <div></div>
>>>>>>>>> </div>
>>>>>>>>> </div>
>>>>>>>>> </div>
>>>>>>>>> </div>
>>>>>>>>> <div class="wizard-view">
>>>>>>>>> <div id="id207">
>>>>>>>>> <span id="id226">
>>>>>>>>> <span id="id227">
>>>>>>>>>
>>>>>>>>> ...
>>>>>>>>>
>>>>>>>>>>> [1]
>>>>>>>>>>>
>>>>>>>>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
>>>>>>>>>>> [2]
>>>>>>>>>>>
>>>>>>>>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86
>>>>>>>>>>>>> Thanks
>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> What is the type of resourceCreateEvent.getTarget() ?
>>>>>>>>>>>>>>>> Is it WebSocketRequestHandler or AjaxRequestHandler ?
>>>>>>>>>>>>>>> "resourceCreateEvent.getTarget()"type is
>>>>>>>>>>>>>>> "AjaxRequestHandler".
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> [1]
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
>>>>>>>>>>>>>>>>> On 21/02/19 10:01, Martin Grigorov wrote:
>>>>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Check the browser's Dev Tools' console for any JavaScript
>>>>>>> errors.
>>>>>>>>>>>>>>>>>> If there are no errors then check in the DevTools
>>>>>>>>>>>>>>>>>> Network tab
>>>>>>>>>>> whether
>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>>>> WebSocket response frame contains the JS code in its
>>>>>>>>>>>>>>>>>> body. It
>>>>>>>>> must
>>>>>>>>>>> be
>>>>>>>>>>>>>>>>>> inside <execution> XML element. If it is not there at all
>>>>> then
>>>>>>> it
>>>>>>>>>>>>> must
>>>>>>>>>>>>>>> be
>>>>>>>>>>>>>>>>>> something on the server side.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> On Thu, Feb 21, 2019 at 10:54 AM Matteo Alessandroni <
>>>>>>>>>>>>>>>>> skylark17@apache.org>
>>>>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> we have a logic where a websocket message is sent from an
>>>>>>>>>>>>> "onEvent()"
>>>>>>>>>>>>>>>>>>> method [1] and catched in a WebSocketBehavior class [2].
>>>>>>>>>>>>>>>>>>> Then, a call to a js method "addEndpoint()"[3] must be
>>>>>>> executed.
>>>>>>>>>>>>>>>>>>> Our problem is that the js code "addEndpoint(...)" inside
>>>>>>>>>>>>>>>>>>> "handler.appendJavaScript(...)" [4] is not executed,
>>>>>>>>>>>>>>>>>>> so the
>>>>>>> code
>>>>>>>>>>>>>>>>>>> correctly reaches that switch case but it's like the
>>>>>>>>>>>>>>>>>>> "appendJavaScript(...)" is not working.
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> On our application v2.0.x that code works and it uses
>>>>>>>>>>>>>>>>>>> Wicket
>>>>>>>>> 7.x,
>>>>>>>>>>>>>>> while
>>>>>>>>>>>>>>>>>>> the newer v2.1.x  uses Wicket 8.x and it does not work.
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Could you please give us an hint of this? Is there
>>>>>>>>>>>>>>>>>>> anything
>>>>> we
>>>>>>>>> are
>>>>>>>>>>>>>>>>>>> missing to make it work for Wicket 8.x?
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Thank you!
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> [1]
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
>>>>>>>>>>>>>>>>>>> [2]
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L153-L157
>>>>>>>>>>>>>>>>>>> [3]
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/resources/META-INF/resources/js/topology.js#L269-L280
>>>>>>>>>>>>>>>>>>> [4]
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L154
>>>>>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>> --
>>>>>>>>>>>>>
>>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>>
>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>>
>>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>>
>>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>>>
>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>>
>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>
>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>
>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>
>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>
>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>
>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>
>>>>>>>>> --
>>>>>>>>>
>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>
>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>
>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>
>>>>>>>>> http://www.tirasa.net
>>>>>>>>>
>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>
>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>
>>>>>>> --
>>>>>>>
>>>>>>> Dott. Matteo Alessandroni
>>>>>>>
>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>
>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>
>>>>>>> http://www.tirasa.net
>>>>>>>
>>>>>>> Apache Syncope PMC Member
>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>
>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>
>>>>> --
>>>>>
>>>>> Dott. Matteo Alessandroni
>>>>>
>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>
>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>
>>>>> http://www.tirasa.net
>>>>>
>>>>> Apache Syncope PMC Member
>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>
>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>
>> --
>>
>> Dott. Matteo Alessandroni
>>
>> Software Engineer @ Tirasa S.r.l.
>>
>> Viale Vittoria Colonna, 97 - 65127 Pescara
>> Tel +39 0859116307 / FAX +39 0859111173
>>
>> http://www.tirasa.net
>>
>> Apache Syncope PMC Member
>> http://people.apache.org/phonebook.html?uid=skylark17
>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>
>> Tirasa S.r.l. <http://www.tirasa.net>
>>

-- 

Dott. Matteo Alessandroni

Software Engineer @ Tirasa S.r.l.

Viale Vittoria Colonna, 97 - 65127 Pescara
Tel +39 0859116307 / FAX +39 0859111173

http://www.tirasa.net

Apache Syncope PMC Member
http://people.apache.org/phonebook.html?uid=skylark17 
<http://people.apache.org/phonebook.html?uid=skylark17>

Tirasa S.r.l. <http://www.tirasa.net>

Re: WebSocketRequestHandler object not executing javascript code

Posted by Martin Grigorov <mg...@apache.org>.
On Fri, Feb 22, 2019 at 1:40 PM Matteo Alessandroni <sk...@apache.org>
wrote:

>
>
> On 22/02/19 12:28, Matteo Alessandroni wrote:
> >
> >
> > On 22/02/19 10:31, Martin Grigorov wrote:
> >> On Fri, Feb 22, 2019 at 10:50 AM Matteo Alessandroni
> >> <sk...@apache.org>
> >> wrote:
> >>
> >>>
> >>> On 21/02/19 18:50, Martin Grigorov wrote:
> >>>> On Thu, Feb 21, 2019, 18:29 Matteo Alessandroni <skylark17@apache.org
> >
> >>>> wrote:
> >>>>
> >>>>> On 21/02/19 16:43, Martin Grigorov wrote:
> >>>>>> On Thu, Feb 21, 2019 at 5:35 PM Matteo Alessandroni <
> >>>>> skylark17@apache.org>
> >>>>>> wrote:
> >>>>>>
> >>>>>>> On 21/02/19 16:30, Martin Grigorov wrote:
> >>>>>>>> On Thu, Feb 21, 2019 at 5:24 PM Matteo Alessandroni <
> >>>>>>> skylark17@apache.org>
> >>>>>>>> wrote:
> >>>>>>>>
> >>>>>>>>> On 21/02/19 16:07, Martin Grigorov wrote:
> >>>>>>>>>> On Thu, Feb 21, 2019 at 4:41 PM Matteo Alessandroni <
> >>>>>>>>> skylark17@apache.org>
> >>>>>>>>>> wrote:
> >>>>>>>>>>
> >>>>>>>>>>> On 21/02/19 12:14, Martin Grigorov wrote:
> >>>>>>>>>>>> On Thu, Feb 21, 2019 at 12:11 PM Matteo Alessandroni <
> >>>>>>>>>>>> matteo.alessandroni@tirasa.net> wrote:
> >>>>>>>>>>>>
> >>>>>>>>>>>>> Hi,
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> On 21/02/19 11:05, Martin Grigorov wrote:
> >>>>>>>>>>>>>> When the WebSocket connection is established (maybe when the
> >>> page
> >>>>>>> is
> >>>>>>>>>>>>>> loaded) you should see an entry in the Network tab.
> >>>>>>>>>>>>>> If you select this entry then on the right-side you
> >>>>>>>>>>>>>> should see
> >>>>> any
> >>>>>>> WS
> >>>>>>>>>>>>>> messages to/from the server.
> >>>>>>>>>>>>> Yes I know how about WS debugging, but I do not see any WS
> >>> request
> >>>>>>>>> (with
> >>>>>>>>>>>>> WS devtool filter and without it).
> >>>>>>>>>>>>>
> >>>>>>>>>>>> Maybe this is the problem.
> >>>>>>>>>>>> If there is no WebSocket response at all then there is no
> >>>>>>>>>>>> way the
> >>>>> JS
> >>>>>>>>> code
> >>>>>>>>>>>> to be executed.
> >>>>>>>>>>>>
> >>>>>>>>>>>> But since your WebSocketBehavior callback method is
> >>>>>>>>>>>> executed then
> >>>>>>> there
> >>>>>>>>>>>> must be an established WebSocket connection.
> >>>>>>>>>>>> I have no idea what goes wrong.
> >>>>>>>>>>> It is strange because in our application version that uses
> >>>>>>>>>>> Wicket
> >>>>> 7.x
> >>>>>>> I
> >>>>>>>>>>> see no WS requests in DevTools console as well, but the code is
> >>>>>>>>>>> correctly executed and everything works.
> >>>>>>>>>>> Yes the WebSocket connection seems to be established anyway in
> >>> both
> >>>>>>> our
> >>>>>>>>>>> versions so with both Wicket 7.x and 8.x, but for some
> >>>>>>>>>>> reason the
> >>>>>>>>>>> "appendJavaScript()" method does not work on the
> >>>>>>>>>>> "WebSocketRequestHandler" object with Wicket 8.x.
> >>>>>>>>>>>
> >>>>>>>>>>> Is there anything else we can try to make it work?
> >>>>>>>>>>>
> >>>>>>>>>> Put a breakpoint at
> >>>>>>>>>>
> >>>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
> >>>
> >>>>>>>>>> and see whether it is called.
> >>>>>>>>>> And another one at
> >>>>>>>>>>
> >>>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86
> >>>
> >>>>>>>>>> to see whether the XML response is being written back to the
> >>> browser
> >>>>> in
> >>>>>>>>> the
> >>>>>>>>>> WebSocketConnection.
> >>>>>>>>> Thanks!
> >>>>>>>>> Ok the first method [1] was called many times and once was the
> >>>>>>>>> one
> >>> I'm
> >>>>>>>>> interested on where the "script" variable was:
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>
> "window.Wicket.WebSocket.send('{"kind":"ADD_ENDPOINT","target":"...","source":"...","scope":"..."}');"
>
> >>>
> >>>>>>>>> also the second one [2] was called, but *only once* and both the
> >>>>> "text"
> >>>>>>>>> and "binary" variables were null.
> >>>>>>>>>
> >>>>>>>> What is the type of "response" variable at
> >>>>>>>>
> >>>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
> >>>
> >>>>>>>> ?
> >>>>>>>> It seems it is not WebSocketResponse
> >>>>>>> Ideed, it's "StringResponse"!
> >>>>>>> And it's content is something like this:
> >>>>>>>
> >>>>>> I didn't expect this!
> >>>>>> Can you please put a breakpoint
> >>>>>> at org.apache.wicket.response.StringResponse#StringResponse() (the
> >>>>>> constructor) and see where it is instantiated.
> >>>>>> AjaxRequestHandler uses StringResponse, but WebSocketRequestHandler
> >>> does
> >>>>>> not.
> >>>>> I'm not completely sure but it seems that all the times the
> >>>>> application
> >>>>> enters in [1] (including when "script" contains "addEnpoint(...)")
> >>>>> and
> >>>>> then the "StringResponse()" constructor is called, the source is [2].
> >>>>>
> >>>>> [1]
> >>>>>
> >>>>>
> >>>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
> >>>
> >>>>> [2]
> >>>>>
> >>>>>
> >>>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestHandler.java#L360
> >>>
> >>>> It seems WebSocketRequestHandler#respond() is not called at all.
> >>>> Put a breakpoint in AbstractWebSocketProcessor and see what happens
> >>> there.
> >>>
> >>> Hi,
> >>> ok thanks, I did that and the constructor of
> >>> "AbstractWebSocketProcessor" is never called!
> >>>
> >> The constructor should be called when the WS connection is established.
> >> I guess you use wicket-native-websocket-javax.
> >> Check org.apache.wicket.protocol.ws.javax.JavaxWebSocketProcessor and
> >> its
> >> org.apache.wicket.protocol.ws
> .javax.JavaxWebSocketProcessor.StringMessageHandler
> >> onMessage() method is called when the client sends something to the
> >> server.
> >> onMessage() delegates
> >> to
> >> org.apache.wicket.protocol.ws
> .api.AbstractWebSocketProcessor#broadcastMessage()
> >> where the processing happens, i.e. WebSocketBehavior#onMessage() is
> >> called.
> >
> > Yes we use "wicket-native-websocket-javax" [1].
> > What I have just done is putting a breackpoint in both that method
> > from
> >
> "org.apache.wicket.protocol.ws.javax.JavaxWebSocketProcessor#StringMessageHandler
> > onMessage()" and
> >
> "org.apache.wicket.protocol.ws.api.AbstractWebSocketProcessor#broadcastMessage()",
>
> > but it does *not* enter there either.
> >
> > So at that point I have tried to start v2.0.x with Wicket 7.x and
> > tried to debug the same way, the result is that it enters in [2] only.
> >
> >
> > [1]
> > https://github.com/apache/syncope/blob/2_1_X/client/console/pom.xml#L83
> > [2]
> >
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/JavaxWebSocketProcessor.java#L65
>
> Sorry I correct myself, I tried again with 2.1.x (Wicket 8.x) and it
> entered in [1] and [2].
>
> [1]
>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/JavaxWebSocketProcessor.java#L65
>
> [2]
>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketProcessor.java#L213


Once the debugger is here set another breakpoint at
https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java#L840
and
https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java#L871

it seems something removes WebSocketRequestHandler from the pipeline and
that's why its #respond() method is not executed.

>
>
> >
> >>
> >>
> >>>>
> >>>>
> >>>>>>> <?xml version="1.0" encoding="UTF-8"?><ajax-response><component
> >>>>>>> id="id178" ><![CDATA[<span id="id178">
> >>>>>>> <div class="wizard-form">
> >>>>>>> <div id="id204">
> >>>>>>> <div class="wizard-overview">
> >>>>>>>
> >>>>>>> </div>
> >>>>>>> <div class="wizard-header">
> >>>>>>> <div>
> >>>>>>> <div>
> >>>>>>> <div class="wizard-step-title">
> >>>>>>> <div></div>
> >>>>>>> </div>
> >>>>>>> <div class="wizard-step-summary">
> >>>>>>> <div></div>
> >>>>>>> </div>
> >>>>>>> </div>
> >>>>>>> </div>
> >>>>>>> </div>
> >>>>>>> <div class="wizard-view">
> >>>>>>> <div id="id207">
> >>>>>>> <span id="id226">
> >>>>>>> <span id="id227">
> >>>>>>>
> >>>>>>> ...
> >>>>>>>
> >>>>>>>>> [1]
> >>>>>>>>>
> >>>>>>>>>
> >>>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
> >>>
> >>>>>>>>> [2]
> >>>>>>>>>
> >>>>>>>>>
> >>>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86
> >>>
> >>>>>>>>>>> Thanks
> >>>>>>>>>>>
> >>>>>>>>>>>>>> What is the type of resourceCreateEvent.getTarget() ?
> >>>>>>>>>>>>>> Is it WebSocketRequestHandler or AjaxRequestHandler ?
> >>>>>>>>>>>>> "resourceCreateEvent.getTarget()"type is
> >>>>>>>>>>>>> "AjaxRequestHandler".
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>>> [1]
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>
> >>>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
> >>>
> >>>>>>>>>>>>>>> On 21/02/19 10:01, Martin Grigorov wrote:
> >>>>>>>>>>>>>>>> Hi,
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> Check the browser's Dev Tools' console for any JavaScript
> >>>>> errors.
> >>>>>>>>>>>>>>>> If there are no errors then check in the DevTools
> >>>>>>>>>>>>>>>> Network tab
> >>>>>>>>> whether
> >>>>>>>>>>>>> the
> >>>>>>>>>>>>>>>> WebSocket response frame contains the JS code in its
> >>>>>>>>>>>>>>>> body. It
> >>>>>>> must
> >>>>>>>>> be
> >>>>>>>>>>>>>>>> inside <execution> XML element. If it is not there at all
> >>> then
> >>>>> it
> >>>>>>>>>>> must
> >>>>>>>>>>>>> be
> >>>>>>>>>>>>>>>> something on the server side.
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> On Thu, Feb 21, 2019 at 10:54 AM Matteo Alessandroni <
> >>>>>>>>>>>>>>> skylark17@apache.org>
> >>>>>>>>>>>>>>>> wrote:
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> Hi,
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> we have a logic where a websocket message is sent from an
> >>>>>>>>>>> "onEvent()"
> >>>>>>>>>>>>>>>>> method [1] and catched in a WebSocketBehavior class [2].
> >>>>>>>>>>>>>>>>> Then, a call to a js method "addEndpoint()"[3] must be
> >>>>> executed.
> >>>>>>>>>>>>>>>>> Our problem is that the js code "addEndpoint(...)" inside
> >>>>>>>>>>>>>>>>> "handler.appendJavaScript(...)" [4] is not executed,
> >>>>>>>>>>>>>>>>> so the
> >>>>> code
> >>>>>>>>>>>>>>>>> correctly reaches that switch case but it's like the
> >>>>>>>>>>>>>>>>> "appendJavaScript(...)" is not working.
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> On our application v2.0.x that code works and it uses
> >>>>>>>>>>>>>>>>> Wicket
> >>>>>>> 7.x,
> >>>>>>>>>>>>> while
> >>>>>>>>>>>>>>>>> the newer v2.1.x  uses Wicket 8.x and it does not work.
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> Could you please give us an hint of this? Is there
> >>>>>>>>>>>>>>>>> anything
> >>> we
> >>>>>>> are
> >>>>>>>>>>>>>>>>> missing to make it work for Wicket 8.x?
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> Thank you!
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> [1]
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>
> >>>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
> >>>
> >>>>>>>>>>>>>>>>> [2]
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>
> >>>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L153-L157
> >>>
> >>>>>>>>>>>>>>>>> [3]
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>
> >>>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/resources/META-INF/resources/js/topology.js#L269-L280
> >>>
> >>>>>>>>>>>>>>>>> [4]
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>
> >>>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L154
> >>>
> >>>>>>>>>>>>>>>>> --
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> Dott. Matteo Alessandroni
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> http://www.tirasa.net
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> Apache Syncope PMC Member
> >>>>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> --
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> Dott. Matteo Alessandroni
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> http://www.tirasa.net
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> Apache Syncope PMC Member
> >>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>> --
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> Dott. Matteo Alessandroni
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> http://www.tirasa.net
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> Apache Syncope PMC Member
> >>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>>>>>>>>
> >>>>>>>>>>> --
> >>>>>>>>>>>
> >>>>>>>>>>> Dott. Matteo Alessandroni
> >>>>>>>>>>>
> >>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>>>>>>
> >>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>>>>>>
> >>>>>>>>>>> http://www.tirasa.net
> >>>>>>>>>>>
> >>>>>>>>>>> Apache Syncope PMC Member
> >>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>>>>>>
> >>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>>>>>>
> >>>>>>>>> --
> >>>>>>>>>
> >>>>>>>>> Dott. Matteo Alessandroni
> >>>>>>>>>
> >>>>>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>>>>
> >>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>>>>
> >>>>>>>>> http://www.tirasa.net
> >>>>>>>>>
> >>>>>>>>> Apache Syncope PMC Member
> >>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>>>>
> >>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>>>>
> >>>>>>> --
> >>>>>>>
> >>>>>>> Dott. Matteo Alessandroni
> >>>>>>>
> >>>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>>
> >>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>>
> >>>>>>> http://www.tirasa.net
> >>>>>>>
> >>>>>>> Apache Syncope PMC Member
> >>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>>
> >>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>>
> >>>>> --
> >>>>>
> >>>>> Dott. Matteo Alessandroni
> >>>>>
> >>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>
> >>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>
> >>>>> http://www.tirasa.net
> >>>>>
> >>>>> Apache Syncope PMC Member
> >>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>
> >>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>
> >>> --
> >>>
> >>> Dott. Matteo Alessandroni
> >>>
> >>> Software Engineer @ Tirasa S.r.l.
> >>>
> >>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>> Tel +39 0859116307 / FAX +39 0859111173
> >>>
> >>> http://www.tirasa.net
> >>>
> >>> Apache Syncope PMC Member
> >>> http://people.apache.org/phonebook.html?uid=skylark17
> >>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>
> >>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>
> >
>
> --
>
> Dott. Matteo Alessandroni
>
> Software Engineer @ Tirasa S.r.l.
>
> Viale Vittoria Colonna, 97 - 65127 Pescara
> Tel +39 0859116307 / FAX +39 0859111173
>
> http://www.tirasa.net
>
> Apache Syncope PMC Member
> http://people.apache.org/phonebook.html?uid=skylark17
> <http://people.apache.org/phonebook.html?uid=skylark17>
>
> Tirasa S.r.l. <http://www.tirasa.net>
>

Re: WebSocketRequestHandler object not executing javascript code

Posted by Matteo Alessandroni <sk...@apache.org>.

On 22/02/19 12:28, Matteo Alessandroni wrote:
>
>
> On 22/02/19 10:31, Martin Grigorov wrote:
>> On Fri, Feb 22, 2019 at 10:50 AM Matteo Alessandroni 
>> <sk...@apache.org>
>> wrote:
>>
>>>
>>> On 21/02/19 18:50, Martin Grigorov wrote:
>>>> On Thu, Feb 21, 2019, 18:29 Matteo Alessandroni <sk...@apache.org>
>>>> wrote:
>>>>
>>>>> On 21/02/19 16:43, Martin Grigorov wrote:
>>>>>> On Thu, Feb 21, 2019 at 5:35 PM Matteo Alessandroni <
>>>>> skylark17@apache.org>
>>>>>> wrote:
>>>>>>
>>>>>>> On 21/02/19 16:30, Martin Grigorov wrote:
>>>>>>>> On Thu, Feb 21, 2019 at 5:24 PM Matteo Alessandroni <
>>>>>>> skylark17@apache.org>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> On 21/02/19 16:07, Martin Grigorov wrote:
>>>>>>>>>> On Thu, Feb 21, 2019 at 4:41 PM Matteo Alessandroni <
>>>>>>>>> skylark17@apache.org>
>>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>>> On 21/02/19 12:14, Martin Grigorov wrote:
>>>>>>>>>>>> On Thu, Feb 21, 2019 at 12:11 PM Matteo Alessandroni <
>>>>>>>>>>>> matteo.alessandroni@tirasa.net> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>
>>>>>>>>>>>>> On 21/02/19 11:05, Martin Grigorov wrote:
>>>>>>>>>>>>>> When the WebSocket connection is established (maybe when the
>>> page
>>>>>>> is
>>>>>>>>>>>>>> loaded) you should see an entry in the Network tab.
>>>>>>>>>>>>>> If you select this entry then on the right-side you 
>>>>>>>>>>>>>> should see
>>>>> any
>>>>>>> WS
>>>>>>>>>>>>>> messages to/from the server.
>>>>>>>>>>>>> Yes I know how about WS debugging, but I do not see any WS
>>> request
>>>>>>>>> (with
>>>>>>>>>>>>> WS devtool filter and without it).
>>>>>>>>>>>>>
>>>>>>>>>>>> Maybe this is the problem.
>>>>>>>>>>>> If there is no WebSocket response at all then there is no 
>>>>>>>>>>>> way the
>>>>> JS
>>>>>>>>> code
>>>>>>>>>>>> to be executed.
>>>>>>>>>>>>
>>>>>>>>>>>> But since your WebSocketBehavior callback method is 
>>>>>>>>>>>> executed then
>>>>>>> there
>>>>>>>>>>>> must be an established WebSocket connection.
>>>>>>>>>>>> I have no idea what goes wrong.
>>>>>>>>>>> It is strange because in our application version that uses 
>>>>>>>>>>> Wicket
>>>>> 7.x
>>>>>>> I
>>>>>>>>>>> see no WS requests in DevTools console as well, but the code is
>>>>>>>>>>> correctly executed and everything works.
>>>>>>>>>>> Yes the WebSocket connection seems to be established anyway in
>>> both
>>>>>>> our
>>>>>>>>>>> versions so with both Wicket 7.x and 8.x, but for some 
>>>>>>>>>>> reason the
>>>>>>>>>>> "appendJavaScript()" method does not work on the
>>>>>>>>>>> "WebSocketRequestHandler" object with Wicket 8.x.
>>>>>>>>>>>
>>>>>>>>>>> Is there anything else we can try to make it work?
>>>>>>>>>>>
>>>>>>>>>> Put a breakpoint at
>>>>>>>>>>
>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141 
>>>
>>>>>>>>>> and see whether it is called.
>>>>>>>>>> And another one at
>>>>>>>>>>
>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86 
>>>
>>>>>>>>>> to see whether the XML response is being written back to the
>>> browser
>>>>> in
>>>>>>>>> the
>>>>>>>>>> WebSocketConnection.
>>>>>>>>> Thanks!
>>>>>>>>> Ok the first method [1] was called many times and once was the 
>>>>>>>>> one
>>> I'm
>>>>>>>>> interested on where the "script" variable was:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>> "window.Wicket.WebSocket.send('{"kind":"ADD_ENDPOINT","target":"...","source":"...","scope":"..."}');" 
>>>
>>>>>>>>> also the second one [2] was called, but *only once* and both the
>>>>> "text"
>>>>>>>>> and "binary" variables were null.
>>>>>>>>>
>>>>>>>> What is the type of "response" variable at
>>>>>>>>
>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141 
>>>
>>>>>>>> ?
>>>>>>>> It seems it is not WebSocketResponse
>>>>>>> Ideed, it's "StringResponse"!
>>>>>>> And it's content is something like this:
>>>>>>>
>>>>>> I didn't expect this!
>>>>>> Can you please put a breakpoint
>>>>>> at org.apache.wicket.response.StringResponse#StringResponse() (the
>>>>>> constructor) and see where it is instantiated.
>>>>>> AjaxRequestHandler uses StringResponse, but WebSocketRequestHandler
>>> does
>>>>>> not.
>>>>> I'm not completely sure but it seems that all the times the 
>>>>> application
>>>>> enters in [1] (including when "script" contains "addEnpoint(...)") 
>>>>> and
>>>>> then the "StringResponse()" constructor is called, the source is [2].
>>>>>
>>>>> [1]
>>>>>
>>>>>
>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141 
>>>
>>>>> [2]
>>>>>
>>>>>
>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestHandler.java#L360 
>>>
>>>> It seems WebSocketRequestHandler#respond() is not called at all.
>>>> Put a breakpoint in AbstractWebSocketProcessor and see what happens
>>> there.
>>>
>>> Hi,
>>> ok thanks, I did that and the constructor of
>>> "AbstractWebSocketProcessor" is never called!
>>>
>> The constructor should be called when the WS connection is established.
>> I guess you use wicket-native-websocket-javax.
>> Check org.apache.wicket.protocol.ws.javax.JavaxWebSocketProcessor and
>> its 
>> org.apache.wicket.protocol.ws.javax.JavaxWebSocketProcessor.StringMessageHandler
>> onMessage() method is called when the client sends something to the 
>> server.
>> onMessage() delegates
>> to 
>> org.apache.wicket.protocol.ws.api.AbstractWebSocketProcessor#broadcastMessage()
>> where the processing happens, i.e. WebSocketBehavior#onMessage() is 
>> called.
>
> Yes we use "wicket-native-websocket-javax" [1].
> What I have just done is putting a breackpoint in both that method 
> from 
> "org.apache.wicket.protocol.ws.javax.JavaxWebSocketProcessor#StringMessageHandler
> onMessage()" and 
> "org.apache.wicket.protocol.ws.api.AbstractWebSocketProcessor#broadcastMessage()", 
> but it does *not* enter there either.
>
> So at that point I have tried to start v2.0.x with Wicket 7.x and 
> tried to debug the same way, the result is that it enters in [2] only.
>
>
> [1] 
> https://github.com/apache/syncope/blob/2_1_X/client/console/pom.xml#L83
> [2] 
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/JavaxWebSocketProcessor.java#L65

Sorry I correct myself, I tried again with 2.1.x (Wicket 8.x) and it 
entered in [1] and [2].

[1] 
https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/JavaxWebSocketProcessor.java#L65 

[2] 
https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketProcessor.java#L213

>
>>
>>
>>>>
>>>>
>>>>>>> <?xml version="1.0" encoding="UTF-8"?><ajax-response><component
>>>>>>> id="id178" ><![CDATA[<span id="id178">
>>>>>>> <div class="wizard-form">
>>>>>>> <div id="id204">
>>>>>>> <div class="wizard-overview">
>>>>>>>
>>>>>>> </div>
>>>>>>> <div class="wizard-header">
>>>>>>> <div>
>>>>>>> <div>
>>>>>>> <div class="wizard-step-title">
>>>>>>> <div></div>
>>>>>>> </div>
>>>>>>> <div class="wizard-step-summary">
>>>>>>> <div></div>
>>>>>>> </div>
>>>>>>> </div>
>>>>>>> </div>
>>>>>>> </div>
>>>>>>> <div class="wizard-view">
>>>>>>> <div id="id207">
>>>>>>> <span id="id226">
>>>>>>> <span id="id227">
>>>>>>>
>>>>>>> ...
>>>>>>>
>>>>>>>>> [1]
>>>>>>>>>
>>>>>>>>>
>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141 
>>>
>>>>>>>>> [2]
>>>>>>>>>
>>>>>>>>>
>>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86 
>>>
>>>>>>>>>>> Thanks
>>>>>>>>>>>
>>>>>>>>>>>>>> What is the type of resourceCreateEvent.getTarget() ?
>>>>>>>>>>>>>> Is it WebSocketRequestHandler or AjaxRequestHandler ?
>>>>>>>>>>>>> "resourceCreateEvent.getTarget()"type is 
>>>>>>>>>>>>> "AjaxRequestHandler".
>>>>>>>>>>>>>
>>>>>>>>>>>>>>> [1]
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609 
>>>
>>>>>>>>>>>>>>> On 21/02/19 10:01, Martin Grigorov wrote:
>>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Check the browser's Dev Tools' console for any JavaScript
>>>>> errors.
>>>>>>>>>>>>>>>> If there are no errors then check in the DevTools 
>>>>>>>>>>>>>>>> Network tab
>>>>>>>>> whether
>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>> WebSocket response frame contains the JS code in its 
>>>>>>>>>>>>>>>> body. It
>>>>>>> must
>>>>>>>>> be
>>>>>>>>>>>>>>>> inside <execution> XML element. If it is not there at all
>>> then
>>>>> it
>>>>>>>>>>> must
>>>>>>>>>>>>> be
>>>>>>>>>>>>>>>> something on the server side.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> On Thu, Feb 21, 2019 at 10:54 AM Matteo Alessandroni <
>>>>>>>>>>>>>>> skylark17@apache.org>
>>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> we have a logic where a websocket message is sent from an
>>>>>>>>>>> "onEvent()"
>>>>>>>>>>>>>>>>> method [1] and catched in a WebSocketBehavior class [2].
>>>>>>>>>>>>>>>>> Then, a call to a js method "addEndpoint()"[3] must be
>>>>> executed.
>>>>>>>>>>>>>>>>> Our problem is that the js code "addEndpoint(...)" inside
>>>>>>>>>>>>>>>>> "handler.appendJavaScript(...)" [4] is not executed, 
>>>>>>>>>>>>>>>>> so the
>>>>> code
>>>>>>>>>>>>>>>>> correctly reaches that switch case but it's like the
>>>>>>>>>>>>>>>>> "appendJavaScript(...)" is not working.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> On our application v2.0.x that code works and it uses 
>>>>>>>>>>>>>>>>> Wicket
>>>>>>> 7.x,
>>>>>>>>>>>>> while
>>>>>>>>>>>>>>>>> the newer v2.1.x  uses Wicket 8.x and it does not work.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Could you please give us an hint of this? Is there 
>>>>>>>>>>>>>>>>> anything
>>> we
>>>>>>> are
>>>>>>>>>>>>>>>>> missing to make it work for Wicket 8.x?
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Thank you!
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> [1]
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609 
>>>
>>>>>>>>>>>>>>>>> [2]
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L153-L157 
>>>
>>>>>>>>>>>>>>>>> [3]
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/resources/META-INF/resources/js/topology.js#L269-L280 
>>>
>>>>>>>>>>>>>>>>> [4]
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L154 
>>>
>>>>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>
>>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>>
>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>>
>>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>>
>>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>>>
>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>>
>>>>>>>>>>> -- 
>>>>>>>>>>>
>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>
>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>
>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>
>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>
>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>
>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>
>>>>>>>>> -- 
>>>>>>>>>
>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>
>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>
>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>
>>>>>>>>> http://www.tirasa.net
>>>>>>>>>
>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>
>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>
>>>>>>> -- 
>>>>>>>
>>>>>>> Dott. Matteo Alessandroni
>>>>>>>
>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>
>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>
>>>>>>> http://www.tirasa.net
>>>>>>>
>>>>>>> Apache Syncope PMC Member
>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>
>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>
>>>>> -- 
>>>>>
>>>>> Dott. Matteo Alessandroni
>>>>>
>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>
>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>
>>>>> http://www.tirasa.net
>>>>>
>>>>> Apache Syncope PMC Member
>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>
>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>
>>> -- 
>>>
>>> Dott. Matteo Alessandroni
>>>
>>> Software Engineer @ Tirasa S.r.l.
>>>
>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>> Tel +39 0859116307 / FAX +39 0859111173
>>>
>>> http://www.tirasa.net
>>>
>>> Apache Syncope PMC Member
>>> http://people.apache.org/phonebook.html?uid=skylark17
>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>
>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>
>

-- 

Dott. Matteo Alessandroni

Software Engineer @ Tirasa S.r.l.

Viale Vittoria Colonna, 97 - 65127 Pescara
Tel +39 0859116307 / FAX +39 0859111173

http://www.tirasa.net

Apache Syncope PMC Member
http://people.apache.org/phonebook.html?uid=skylark17 
<http://people.apache.org/phonebook.html?uid=skylark17>

Tirasa S.r.l. <http://www.tirasa.net>

Re: WebSocketRequestHandler object not executing javascript code

Posted by Matteo Alessandroni <sk...@apache.org>.

On 22/02/19 10:31, Martin Grigorov wrote:
> On Fri, Feb 22, 2019 at 10:50 AM Matteo Alessandroni <sk...@apache.org>
> wrote:
>
>>
>> On 21/02/19 18:50, Martin Grigorov wrote:
>>> On Thu, Feb 21, 2019, 18:29 Matteo Alessandroni <sk...@apache.org>
>>> wrote:
>>>
>>>> On 21/02/19 16:43, Martin Grigorov wrote:
>>>>> On Thu, Feb 21, 2019 at 5:35 PM Matteo Alessandroni <
>>>> skylark17@apache.org>
>>>>> wrote:
>>>>>
>>>>>> On 21/02/19 16:30, Martin Grigorov wrote:
>>>>>>> On Thu, Feb 21, 2019 at 5:24 PM Matteo Alessandroni <
>>>>>> skylark17@apache.org>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> On 21/02/19 16:07, Martin Grigorov wrote:
>>>>>>>>> On Thu, Feb 21, 2019 at 4:41 PM Matteo Alessandroni <
>>>>>>>> skylark17@apache.org>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> On 21/02/19 12:14, Martin Grigorov wrote:
>>>>>>>>>>> On Thu, Feb 21, 2019 at 12:11 PM Matteo Alessandroni <
>>>>>>>>>>> matteo.alessandroni@tirasa.net> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hi,
>>>>>>>>>>>>
>>>>>>>>>>>> On 21/02/19 11:05, Martin Grigorov wrote:
>>>>>>>>>>>>> When the WebSocket connection is established (maybe when the
>> page
>>>>>> is
>>>>>>>>>>>>> loaded) you should see an entry in the Network tab.
>>>>>>>>>>>>> If you select this entry then on the right-side you should see
>>>> any
>>>>>> WS
>>>>>>>>>>>>> messages to/from the server.
>>>>>>>>>>>> Yes I know how about WS debugging, but I do not see any WS
>> request
>>>>>>>> (with
>>>>>>>>>>>> WS devtool filter and without it).
>>>>>>>>>>>>
>>>>>>>>>>> Maybe this is the problem.
>>>>>>>>>>> If there is no WebSocket response at all then there is no way the
>>>> JS
>>>>>>>> code
>>>>>>>>>>> to be executed.
>>>>>>>>>>>
>>>>>>>>>>> But since your WebSocketBehavior callback method is executed then
>>>>>> there
>>>>>>>>>>> must be an established WebSocket connection.
>>>>>>>>>>> I have no idea what goes wrong.
>>>>>>>>>> It is strange because in our application version that uses Wicket
>>>> 7.x
>>>>>> I
>>>>>>>>>> see no WS requests in DevTools console as well, but the code is
>>>>>>>>>> correctly executed and everything works.
>>>>>>>>>> Yes the WebSocket connection seems to be established anyway in
>> both
>>>>>> our
>>>>>>>>>> versions so with both Wicket 7.x and 8.x, but for some reason the
>>>>>>>>>> "appendJavaScript()" method does not work on the
>>>>>>>>>> "WebSocketRequestHandler" object with Wicket 8.x.
>>>>>>>>>>
>>>>>>>>>> Is there anything else we can try to make it work?
>>>>>>>>>>
>>>>>>>>> Put a breakpoint at
>>>>>>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
>>>>>>>>> and see whether it is called.
>>>>>>>>> And another one at
>>>>>>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86
>>>>>>>>> to see whether the XML response is being written back to the
>> browser
>>>> in
>>>>>>>> the
>>>>>>>>> WebSocketConnection.
>>>>>>>> Thanks!
>>>>>>>> Ok the first method [1] was called many times and once was the one
>> I'm
>>>>>>>> interested on where the "script" variable was:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>> "window.Wicket.WebSocket.send('{"kind":"ADD_ENDPOINT","target":"...","source":"...","scope":"..."}');"
>>>>>>>> also the second one [2] was called, but *only once* and both the
>>>> "text"
>>>>>>>> and "binary" variables were null.
>>>>>>>>
>>>>>>> What is the type of "response" variable at
>>>>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
>>>>>>> ?
>>>>>>> It seems it is not WebSocketResponse
>>>>>> Ideed, it's "StringResponse"!
>>>>>> And it's content is something like this:
>>>>>>
>>>>> I didn't expect this!
>>>>> Can you please put a breakpoint
>>>>> at org.apache.wicket.response.StringResponse#StringResponse() (the
>>>>> constructor) and see where it is instantiated.
>>>>> AjaxRequestHandler uses StringResponse, but WebSocketRequestHandler
>> does
>>>>> not.
>>>> I'm not completely sure but it seems that all the times the application
>>>> enters in [1] (including when "script" contains "addEnpoint(...)") and
>>>> then the "StringResponse()" constructor is called, the source is [2].
>>>>
>>>> [1]
>>>>
>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
>>>> [2]
>>>>
>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestHandler.java#L360
>>> It seems WebSocketRequestHandler#respond() is not called at all.
>>> Put a breakpoint in AbstractWebSocketProcessor and see what happens
>> there.
>>
>> Hi,
>> ok thanks, I did that and the constructor of
>> "AbstractWebSocketProcessor" is never called!
>>
> The constructor should be called when the WS connection is established.
> I guess you use wicket-native-websocket-javax.
> Check org.apache.wicket.protocol.ws.javax.JavaxWebSocketProcessor and
> its org.apache.wicket.protocol.ws.javax.JavaxWebSocketProcessor.StringMessageHandler
> onMessage() method is called when the client sends something to the server.
> onMessage() delegates
> to org.apache.wicket.protocol.ws.api.AbstractWebSocketProcessor#broadcastMessage()
> where the processing happens, i.e. WebSocketBehavior#onMessage() is called.

Yes we use "wicket-native-websocket-javax" [1].
What I have just done is putting a breackpoint in both that method from 
"org.apache.wicket.protocol.ws.javax.JavaxWebSocketProcessor#StringMessageHandler
onMessage()" and 
"org.apache.wicket.protocol.ws.api.AbstractWebSocketProcessor#broadcastMessage()", 
but it does *not* enter there either.

So at that point I have tried to start v2.0.x with Wicket 7.x and tried 
to debug the same way, the result is that it enters in [2] only.


[1] https://github.com/apache/syncope/blob/2_1_X/client/console/pom.xml#L83
[2] 
https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/JavaxWebSocketProcessor.java#L65

>
>
>>>
>>>
>>>>>> <?xml version="1.0" encoding="UTF-8"?><ajax-response><component
>>>>>> id="id178" ><![CDATA[<span id="id178">
>>>>>> <div class="wizard-form">
>>>>>> <div id="id204">
>>>>>> <div class="wizard-overview">
>>>>>>
>>>>>> </div>
>>>>>> <div class="wizard-header">
>>>>>> <div>
>>>>>> <div>
>>>>>> <div class="wizard-step-title">
>>>>>> <div></div>
>>>>>> </div>
>>>>>> <div class="wizard-step-summary">
>>>>>> <div></div>
>>>>>> </div>
>>>>>> </div>
>>>>>> </div>
>>>>>> </div>
>>>>>> <div class="wizard-view">
>>>>>> <div id="id207">
>>>>>> <span id="id226">
>>>>>> <span id="id227">
>>>>>>
>>>>>> ...
>>>>>>
>>>>>>>> [1]
>>>>>>>>
>>>>>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
>>>>>>>> [2]
>>>>>>>>
>>>>>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86
>>>>>>>>>> Thanks
>>>>>>>>>>
>>>>>>>>>>>>> What is the type of resourceCreateEvent.getTarget() ?
>>>>>>>>>>>>> Is it WebSocketRequestHandler or AjaxRequestHandler ?
>>>>>>>>>>>> "resourceCreateEvent.getTarget()"type is "AjaxRequestHandler".
>>>>>>>>>>>>
>>>>>>>>>>>>>> [1]
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
>>>>>>>>>>>>>> On 21/02/19 10:01, Martin Grigorov wrote:
>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Check the browser's Dev Tools' console for any JavaScript
>>>> errors.
>>>>>>>>>>>>>>> If there are no errors then check in the DevTools Network tab
>>>>>>>> whether
>>>>>>>>>>>> the
>>>>>>>>>>>>>>> WebSocket response frame contains the JS code in its body. It
>>>>>> must
>>>>>>>> be
>>>>>>>>>>>>>>> inside <execution> XML element. If it is not there at all
>> then
>>>> it
>>>>>>>>>> must
>>>>>>>>>>>> be
>>>>>>>>>>>>>>> something on the server side.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On Thu, Feb 21, 2019 at 10:54 AM Matteo Alessandroni <
>>>>>>>>>>>>>> skylark17@apache.org>
>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> we have a logic where a websocket message is sent from an
>>>>>>>>>> "onEvent()"
>>>>>>>>>>>>>>>> method [1] and catched in a WebSocketBehavior class [2].
>>>>>>>>>>>>>>>> Then, a call to a js method "addEndpoint()"[3] must be
>>>> executed.
>>>>>>>>>>>>>>>> Our problem is that the js code "addEndpoint(...)" inside
>>>>>>>>>>>>>>>> "handler.appendJavaScript(...)" [4] is not executed, so the
>>>> code
>>>>>>>>>>>>>>>> correctly reaches that switch case but it's like the
>>>>>>>>>>>>>>>> "appendJavaScript(...)" is not working.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> On our application v2.0.x that code works and it uses Wicket
>>>>>> 7.x,
>>>>>>>>>>>> while
>>>>>>>>>>>>>>>> the newer v2.1.x  uses Wicket 8.x and it does not work.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Could you please give us an hint of this? Is there anything
>> we
>>>>>> are
>>>>>>>>>>>>>>>> missing to make it work for Wicket 8.x?
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Thank you!
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> [1]
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
>>>>>>>>>>>>>>>> [2]
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L153-L157
>>>>>>>>>>>>>>>> [3]
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/resources/META-INF/resources/js/topology.js#L269-L280
>>>>>>>>>>>>>>>> [4]
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L154
>>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>>
>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>
>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>
>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>
>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>
>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>>
>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>>
>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>
>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>
>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>
>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>
>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>
>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>
>>>>>>>> --
>>>>>>>>
>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>
>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>
>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>
>>>>>>>> http://www.tirasa.net
>>>>>>>>
>>>>>>>> Apache Syncope PMC Member
>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>
>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>
>>>>>> --
>>>>>>
>>>>>> Dott. Matteo Alessandroni
>>>>>>
>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>
>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>
>>>>>> http://www.tirasa.net
>>>>>>
>>>>>> Apache Syncope PMC Member
>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>
>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>
>>>> --
>>>>
>>>> Dott. Matteo Alessandroni
>>>>
>>>> Software Engineer @ Tirasa S.r.l.
>>>>
>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>
>>>> http://www.tirasa.net
>>>>
>>>> Apache Syncope PMC Member
>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>
>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>
>> --
>>
>> Dott. Matteo Alessandroni
>>
>> Software Engineer @ Tirasa S.r.l.
>>
>> Viale Vittoria Colonna, 97 - 65127 Pescara
>> Tel +39 0859116307 / FAX +39 0859111173
>>
>> http://www.tirasa.net
>>
>> Apache Syncope PMC Member
>> http://people.apache.org/phonebook.html?uid=skylark17
>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>
>> Tirasa S.r.l. <http://www.tirasa.net>
>>

-- 

Dott. Matteo Alessandroni

Software Engineer @ Tirasa S.r.l.

Viale Vittoria Colonna, 97 - 65127 Pescara
Tel +39 0859116307 / FAX +39 0859111173

http://www.tirasa.net

Apache Syncope PMC Member
http://people.apache.org/phonebook.html?uid=skylark17 
<http://people.apache.org/phonebook.html?uid=skylark17>

Tirasa S.r.l. <http://www.tirasa.net>

Re: WebSocketRequestHandler object not executing javascript code

Posted by Martin Grigorov <mg...@apache.org>.
On Fri, Feb 22, 2019 at 10:50 AM Matteo Alessandroni <sk...@apache.org>
wrote:

>
>
> On 21/02/19 18:50, Martin Grigorov wrote:
> > On Thu, Feb 21, 2019, 18:29 Matteo Alessandroni <sk...@apache.org>
> > wrote:
> >
> >>
> >> On 21/02/19 16:43, Martin Grigorov wrote:
> >>> On Thu, Feb 21, 2019 at 5:35 PM Matteo Alessandroni <
> >> skylark17@apache.org>
> >>> wrote:
> >>>
> >>>> On 21/02/19 16:30, Martin Grigorov wrote:
> >>>>> On Thu, Feb 21, 2019 at 5:24 PM Matteo Alessandroni <
> >>>> skylark17@apache.org>
> >>>>> wrote:
> >>>>>
> >>>>>> On 21/02/19 16:07, Martin Grigorov wrote:
> >>>>>>> On Thu, Feb 21, 2019 at 4:41 PM Matteo Alessandroni <
> >>>>>> skylark17@apache.org>
> >>>>>>> wrote:
> >>>>>>>
> >>>>>>>> On 21/02/19 12:14, Martin Grigorov wrote:
> >>>>>>>>> On Thu, Feb 21, 2019 at 12:11 PM Matteo Alessandroni <
> >>>>>>>>> matteo.alessandroni@tirasa.net> wrote:
> >>>>>>>>>
> >>>>>>>>>> Hi,
> >>>>>>>>>>
> >>>>>>>>>> On 21/02/19 11:05, Martin Grigorov wrote:
> >>>>>>>>>>> When the WebSocket connection is established (maybe when the
> page
> >>>> is
> >>>>>>>>>>> loaded) you should see an entry in the Network tab.
> >>>>>>>>>>> If you select this entry then on the right-side you should see
> >> any
> >>>> WS
> >>>>>>>>>>> messages to/from the server.
> >>>>>>>>>> Yes I know how about WS debugging, but I do not see any WS
> request
> >>>>>> (with
> >>>>>>>>>> WS devtool filter and without it).
> >>>>>>>>>>
> >>>>>>>>> Maybe this is the problem.
> >>>>>>>>> If there is no WebSocket response at all then there is no way the
> >> JS
> >>>>>> code
> >>>>>>>>> to be executed.
> >>>>>>>>>
> >>>>>>>>> But since your WebSocketBehavior callback method is executed then
> >>>> there
> >>>>>>>>> must be an established WebSocket connection.
> >>>>>>>>> I have no idea what goes wrong.
> >>>>>>>> It is strange because in our application version that uses Wicket
> >> 7.x
> >>>> I
> >>>>>>>> see no WS requests in DevTools console as well, but the code is
> >>>>>>>> correctly executed and everything works.
> >>>>>>>> Yes the WebSocket connection seems to be established anyway in
> both
> >>>> our
> >>>>>>>> versions so with both Wicket 7.x and 8.x, but for some reason the
> >>>>>>>> "appendJavaScript()" method does not work on the
> >>>>>>>> "WebSocketRequestHandler" object with Wicket 8.x.
> >>>>>>>>
> >>>>>>>> Is there anything else we can try to make it work?
> >>>>>>>>
> >>>>>>> Put a breakpoint at
> >>>>>>>
> >>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
> >>>>>>> and see whether it is called.
> >>>>>>> And another one at
> >>>>>>>
> >>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86
> >>>>>>> to see whether the XML response is being written back to the
> browser
> >> in
> >>>>>> the
> >>>>>>> WebSocketConnection.
> >>>>>> Thanks!
> >>>>>> Ok the first method [1] was called many times and once was the one
> I'm
> >>>>>> interested on where the "script" variable was:
> >>>>>>
> >>>>>>
> >>>>>>
> >>
> "window.Wicket.WebSocket.send('{"kind":"ADD_ENDPOINT","target":"...","source":"...","scope":"..."}');"
> >>>>>> also the second one [2] was called, but *only once* and both the
> >> "text"
> >>>>>> and "binary" variables were null.
> >>>>>>
> >>>>> What is the type of "response" variable at
> >>>>>
> >>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
> >>>>> ?
> >>>>> It seems it is not WebSocketResponse
> >>>> Ideed, it's "StringResponse"!
> >>>> And it's content is something like this:
> >>>>
> >>> I didn't expect this!
> >>> Can you please put a breakpoint
> >>> at org.apache.wicket.response.StringResponse#StringResponse() (the
> >>> constructor) and see where it is instantiated.
> >>> AjaxRequestHandler uses StringResponse, but WebSocketRequestHandler
> does
> >>> not.
> >> I'm not completely sure but it seems that all the times the application
> >> enters in [1] (including when "script" contains "addEnpoint(...)") and
> >> then the "StringResponse()" constructor is called, the source is [2].
> >>
> >> [1]
> >>
> >>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
> >> [2]
> >>
> >>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestHandler.java#L360
> >
> > It seems WebSocketRequestHandler#respond() is not called at all.
> > Put a breakpoint in AbstractWebSocketProcessor and see what happens
> there.
>
> Hi,
> ok thanks, I did that and the constructor of
> "AbstractWebSocketProcessor" is never called!
>

The constructor should be called when the WS connection is established.
I guess you use wicket-native-websocket-javax.
Check org.apache.wicket.protocol.ws.javax.JavaxWebSocketProcessor and
its org.apache.wicket.protocol.ws.javax.JavaxWebSocketProcessor.StringMessageHandler
onMessage() method is called when the client sends something to the server.
onMessage() delegates
to org.apache.wicket.protocol.ws.api.AbstractWebSocketProcessor#broadcastMessage()
where the processing happens, i.e. WebSocketBehavior#onMessage() is called.


>
> >
> >
> >
> >>>> <?xml version="1.0" encoding="UTF-8"?><ajax-response><component
> >>>> id="id178" ><![CDATA[<span id="id178">
> >>>> <div class="wizard-form">
> >>>> <div id="id204">
> >>>> <div class="wizard-overview">
> >>>>
> >>>> </div>
> >>>> <div class="wizard-header">
> >>>> <div>
> >>>> <div>
> >>>> <div class="wizard-step-title">
> >>>> <div></div>
> >>>> </div>
> >>>> <div class="wizard-step-summary">
> >>>> <div></div>
> >>>> </div>
> >>>> </div>
> >>>> </div>
> >>>> </div>
> >>>> <div class="wizard-view">
> >>>> <div id="id207">
> >>>> <span id="id226">
> >>>> <span id="id227">
> >>>>
> >>>> ...
> >>>>
> >>>>>> [1]
> >>>>>>
> >>>>>>
> >>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
> >>>>>> [2]
> >>>>>>
> >>>>>>
> >>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86
> >>>>>>>> Thanks
> >>>>>>>>
> >>>>>>>>>>> What is the type of resourceCreateEvent.getTarget() ?
> >>>>>>>>>>> Is it WebSocketRequestHandler or AjaxRequestHandler ?
> >>>>>>>>>> "resourceCreateEvent.getTarget()"type is "AjaxRequestHandler".
> >>>>>>>>>>
> >>>>>>>>>>>> [1]
> >>>>>>>>>>>>
> >>>>>>>>>>>>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
> >>>>>>>>>>>> On 21/02/19 10:01, Martin Grigorov wrote:
> >>>>>>>>>>>>> Hi,
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> Check the browser's Dev Tools' console for any JavaScript
> >> errors.
> >>>>>>>>>>>>> If there are no errors then check in the DevTools Network tab
> >>>>>> whether
> >>>>>>>>>> the
> >>>>>>>>>>>>> WebSocket response frame contains the JS code in its body. It
> >>>> must
> >>>>>> be
> >>>>>>>>>>>>> inside <execution> XML element. If it is not there at all
> then
> >> it
> >>>>>>>> must
> >>>>>>>>>> be
> >>>>>>>>>>>>> something on the server side.
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> On Thu, Feb 21, 2019 at 10:54 AM Matteo Alessandroni <
> >>>>>>>>>>>> skylark17@apache.org>
> >>>>>>>>>>>>> wrote:
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>> Hi,
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> we have a logic where a websocket message is sent from an
> >>>>>>>> "onEvent()"
> >>>>>>>>>>>>>> method [1] and catched in a WebSocketBehavior class [2].
> >>>>>>>>>>>>>> Then, a call to a js method "addEndpoint()"[3] must be
> >> executed.
> >>>>>>>>>>>>>> Our problem is that the js code "addEndpoint(...)" inside
> >>>>>>>>>>>>>> "handler.appendJavaScript(...)" [4] is not executed, so the
> >> code
> >>>>>>>>>>>>>> correctly reaches that switch case but it's like the
> >>>>>>>>>>>>>> "appendJavaScript(...)" is not working.
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> On our application v2.0.x that code works and it uses Wicket
> >>>> 7.x,
> >>>>>>>>>> while
> >>>>>>>>>>>>>> the newer v2.1.x  uses Wicket 8.x and it does not work.
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Could you please give us an hint of this? Is there anything
> we
> >>>> are
> >>>>>>>>>>>>>> missing to make it work for Wicket 8.x?
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Thank you!
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> [1]
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
> >>>>>>>>>>>>>> [2]
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L153-L157
> >>>>>>>>>>>>>> [3]
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/resources/META-INF/resources/js/topology.js#L269-L280
> >>>>>>>>>>>>>> [4]
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L154
> >>>>>>>>>>>>>> --
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Dott. Matteo Alessandroni
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> http://www.tirasa.net
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Apache Syncope PMC Member
> >>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>>>>>>>>>
> >>>>>>>>>>>> --
> >>>>>>>>>>>>
> >>>>>>>>>>>> Dott. Matteo Alessandroni
> >>>>>>>>>>>>
> >>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>>>>>>>
> >>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>>>>>>>
> >>>>>>>>>>>> http://www.tirasa.net
> >>>>>>>>>>>>
> >>>>>>>>>>>> Apache Syncope PMC Member
> >>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>>>>>>>
> >>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>>>>>>>
> >>>>>>>>>> --
> >>>>>>>>>>
> >>>>>>>>>> Dott. Matteo Alessandroni
> >>>>>>>>>>
> >>>>>>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>>>>>
> >>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>>>>>
> >>>>>>>>>> http://www.tirasa.net
> >>>>>>>>>>
> >>>>>>>>>> Apache Syncope PMC Member
> >>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>>>>>
> >>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>>>>>
> >>>>>>>> --
> >>>>>>>>
> >>>>>>>> Dott. Matteo Alessandroni
> >>>>>>>>
> >>>>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>>>
> >>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>>>
> >>>>>>>> http://www.tirasa.net
> >>>>>>>>
> >>>>>>>> Apache Syncope PMC Member
> >>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>>>
> >>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>>>
> >>>>>> --
> >>>>>>
> >>>>>> Dott. Matteo Alessandroni
> >>>>>>
> >>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>
> >>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>
> >>>>>> http://www.tirasa.net
> >>>>>>
> >>>>>> Apache Syncope PMC Member
> >>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>
> >>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>
> >>>> --
> >>>>
> >>>> Dott. Matteo Alessandroni
> >>>>
> >>>> Software Engineer @ Tirasa S.r.l.
> >>>>
> >>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>
> >>>> http://www.tirasa.net
> >>>>
> >>>> Apache Syncope PMC Member
> >>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>
> >>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>
> >> --
> >>
> >> Dott. Matteo Alessandroni
> >>
> >> Software Engineer @ Tirasa S.r.l.
> >>
> >> Viale Vittoria Colonna, 97 - 65127 Pescara
> >> Tel +39 0859116307 / FAX +39 0859111173
> >>
> >> http://www.tirasa.net
> >>
> >> Apache Syncope PMC Member
> >> http://people.apache.org/phonebook.html?uid=skylark17
> >> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>
> >> Tirasa S.r.l. <http://www.tirasa.net>
> >>
>
> --
>
> Dott. Matteo Alessandroni
>
> Software Engineer @ Tirasa S.r.l.
>
> Viale Vittoria Colonna, 97 - 65127 Pescara
> Tel +39 0859116307 / FAX +39 0859111173
>
> http://www.tirasa.net
>
> Apache Syncope PMC Member
> http://people.apache.org/phonebook.html?uid=skylark17
> <http://people.apache.org/phonebook.html?uid=skylark17>
>
> Tirasa S.r.l. <http://www.tirasa.net>
>

Re: WebSocketRequestHandler object not executing javascript code

Posted by Matteo Alessandroni <sk...@apache.org>.

On 21/02/19 18:50, Martin Grigorov wrote:
> On Thu, Feb 21, 2019, 18:29 Matteo Alessandroni <sk...@apache.org>
> wrote:
>
>>
>> On 21/02/19 16:43, Martin Grigorov wrote:
>>> On Thu, Feb 21, 2019 at 5:35 PM Matteo Alessandroni <
>> skylark17@apache.org>
>>> wrote:
>>>
>>>> On 21/02/19 16:30, Martin Grigorov wrote:
>>>>> On Thu, Feb 21, 2019 at 5:24 PM Matteo Alessandroni <
>>>> skylark17@apache.org>
>>>>> wrote:
>>>>>
>>>>>> On 21/02/19 16:07, Martin Grigorov wrote:
>>>>>>> On Thu, Feb 21, 2019 at 4:41 PM Matteo Alessandroni <
>>>>>> skylark17@apache.org>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> On 21/02/19 12:14, Martin Grigorov wrote:
>>>>>>>>> On Thu, Feb 21, 2019 at 12:11 PM Matteo Alessandroni <
>>>>>>>>> matteo.alessandroni@tirasa.net> wrote:
>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> On 21/02/19 11:05, Martin Grigorov wrote:
>>>>>>>>>>> When the WebSocket connection is established (maybe when the page
>>>> is
>>>>>>>>>>> loaded) you should see an entry in the Network tab.
>>>>>>>>>>> If you select this entry then on the right-side you should see
>> any
>>>> WS
>>>>>>>>>>> messages to/from the server.
>>>>>>>>>> Yes I know how about WS debugging, but I do not see any WS request
>>>>>> (with
>>>>>>>>>> WS devtool filter and without it).
>>>>>>>>>>
>>>>>>>>> Maybe this is the problem.
>>>>>>>>> If there is no WebSocket response at all then there is no way the
>> JS
>>>>>> code
>>>>>>>>> to be executed.
>>>>>>>>>
>>>>>>>>> But since your WebSocketBehavior callback method is executed then
>>>> there
>>>>>>>>> must be an established WebSocket connection.
>>>>>>>>> I have no idea what goes wrong.
>>>>>>>> It is strange because in our application version that uses Wicket
>> 7.x
>>>> I
>>>>>>>> see no WS requests in DevTools console as well, but the code is
>>>>>>>> correctly executed and everything works.
>>>>>>>> Yes the WebSocket connection seems to be established anyway in both
>>>> our
>>>>>>>> versions so with both Wicket 7.x and 8.x, but for some reason the
>>>>>>>> "appendJavaScript()" method does not work on the
>>>>>>>> "WebSocketRequestHandler" object with Wicket 8.x.
>>>>>>>>
>>>>>>>> Is there anything else we can try to make it work?
>>>>>>>>
>>>>>>> Put a breakpoint at
>>>>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
>>>>>>> and see whether it is called.
>>>>>>> And another one at
>>>>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86
>>>>>>> to see whether the XML response is being written back to the browser
>> in
>>>>>> the
>>>>>>> WebSocketConnection.
>>>>>> Thanks!
>>>>>> Ok the first method [1] was called many times and once was the one I'm
>>>>>> interested on where the "script" variable was:
>>>>>>
>>>>>>
>>>>>>
>> "window.Wicket.WebSocket.send('{"kind":"ADD_ENDPOINT","target":"...","source":"...","scope":"..."}');"
>>>>>> also the second one [2] was called, but *only once* and both the
>> "text"
>>>>>> and "binary" variables were null.
>>>>>>
>>>>> What is the type of "response" variable at
>>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
>>>>> ?
>>>>> It seems it is not WebSocketResponse
>>>> Ideed, it's "StringResponse"!
>>>> And it's content is something like this:
>>>>
>>> I didn't expect this!
>>> Can you please put a breakpoint
>>> at org.apache.wicket.response.StringResponse#StringResponse() (the
>>> constructor) and see where it is instantiated.
>>> AjaxRequestHandler uses StringResponse, but WebSocketRequestHandler does
>>> not.
>> I'm not completely sure but it seems that all the times the application
>> enters in [1] (including when "script" contains "addEnpoint(...)") and
>> then the "StringResponse()" constructor is called, the source is [2].
>>
>> [1]
>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
>> [2]
>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestHandler.java#L360
>
> It seems WebSocketRequestHandler#respond() is not called at all.
> Put a breakpoint in AbstractWebSocketProcessor and see what happens there.

Hi,
ok thanks, I did that and the constructor of 
"AbstractWebSocketProcessor" is never called!

>
>
>
>>>> <?xml version="1.0" encoding="UTF-8"?><ajax-response><component
>>>> id="id178" ><![CDATA[<span id="id178">
>>>> <div class="wizard-form">
>>>> <div id="id204">
>>>> <div class="wizard-overview">
>>>>
>>>> </div>
>>>> <div class="wizard-header">
>>>> <div>
>>>> <div>
>>>> <div class="wizard-step-title">
>>>> <div></div>
>>>> </div>
>>>> <div class="wizard-step-summary">
>>>> <div></div>
>>>> </div>
>>>> </div>
>>>> </div>
>>>> </div>
>>>> <div class="wizard-view">
>>>> <div id="id207">
>>>> <span id="id226">
>>>> <span id="id227">
>>>>
>>>> ...
>>>>
>>>>>> [1]
>>>>>>
>>>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
>>>>>> [2]
>>>>>>
>>>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86
>>>>>>>> Thanks
>>>>>>>>
>>>>>>>>>>> What is the type of resourceCreateEvent.getTarget() ?
>>>>>>>>>>> Is it WebSocketRequestHandler or AjaxRequestHandler ?
>>>>>>>>>> "resourceCreateEvent.getTarget()"type is "AjaxRequestHandler".
>>>>>>>>>>
>>>>>>>>>>>> [1]
>>>>>>>>>>>>
>>>>>>>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
>>>>>>>>>>>> On 21/02/19 10:01, Martin Grigorov wrote:
>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>
>>>>>>>>>>>>> Check the browser's Dev Tools' console for any JavaScript
>> errors.
>>>>>>>>>>>>> If there are no errors then check in the DevTools Network tab
>>>>>> whether
>>>>>>>>>> the
>>>>>>>>>>>>> WebSocket response frame contains the JS code in its body. It
>>>> must
>>>>>> be
>>>>>>>>>>>>> inside <execution> XML element. If it is not there at all then
>> it
>>>>>>>> must
>>>>>>>>>> be
>>>>>>>>>>>>> something on the server side.
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Thu, Feb 21, 2019 at 10:54 AM Matteo Alessandroni <
>>>>>>>>>>>> skylark17@apache.org>
>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> we have a logic where a websocket message is sent from an
>>>>>>>> "onEvent()"
>>>>>>>>>>>>>> method [1] and catched in a WebSocketBehavior class [2].
>>>>>>>>>>>>>> Then, a call to a js method "addEndpoint()"[3] must be
>> executed.
>>>>>>>>>>>>>> Our problem is that the js code "addEndpoint(...)" inside
>>>>>>>>>>>>>> "handler.appendJavaScript(...)" [4] is not executed, so the
>> code
>>>>>>>>>>>>>> correctly reaches that switch case but it's like the
>>>>>>>>>>>>>> "appendJavaScript(...)" is not working.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On our application v2.0.x that code works and it uses Wicket
>>>> 7.x,
>>>>>>>>>> while
>>>>>>>>>>>>>> the newer v2.1.x  uses Wicket 8.x and it does not work.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Could you please give us an hint of this? Is there anything we
>>>> are
>>>>>>>>>>>>>> missing to make it work for Wicket 8.x?
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Thank you!
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> [1]
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
>>>>>>>>>>>>>> [2]
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L153-L157
>>>>>>>>>>>>>> [3]
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/resources/META-INF/resources/js/topology.js#L269-L280
>>>>>>>>>>>>>> [4]
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L154
>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>>
>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>
>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>
>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>
>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>
>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>>
>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>>
>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>
>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>
>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>
>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>
>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>
>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>
>>>>>>>> --
>>>>>>>>
>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>
>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>
>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>
>>>>>>>> http://www.tirasa.net
>>>>>>>>
>>>>>>>> Apache Syncope PMC Member
>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>
>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>
>>>>>> --
>>>>>>
>>>>>> Dott. Matteo Alessandroni
>>>>>>
>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>
>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>
>>>>>> http://www.tirasa.net
>>>>>>
>>>>>> Apache Syncope PMC Member
>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>
>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>
>>>> --
>>>>
>>>> Dott. Matteo Alessandroni
>>>>
>>>> Software Engineer @ Tirasa S.r.l.
>>>>
>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>
>>>> http://www.tirasa.net
>>>>
>>>> Apache Syncope PMC Member
>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>
>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>
>> --
>>
>> Dott. Matteo Alessandroni
>>
>> Software Engineer @ Tirasa S.r.l.
>>
>> Viale Vittoria Colonna, 97 - 65127 Pescara
>> Tel +39 0859116307 / FAX +39 0859111173
>>
>> http://www.tirasa.net
>>
>> Apache Syncope PMC Member
>> http://people.apache.org/phonebook.html?uid=skylark17
>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>
>> Tirasa S.r.l. <http://www.tirasa.net>
>>

-- 

Dott. Matteo Alessandroni

Software Engineer @ Tirasa S.r.l.

Viale Vittoria Colonna, 97 - 65127 Pescara
Tel +39 0859116307 / FAX +39 0859111173

http://www.tirasa.net

Apache Syncope PMC Member
http://people.apache.org/phonebook.html?uid=skylark17 
<http://people.apache.org/phonebook.html?uid=skylark17>

Tirasa S.r.l. <http://www.tirasa.net>

Re: WebSocketRequestHandler object not executing javascript code

Posted by Martin Grigorov <ma...@gmail.com>.
On Thu, Feb 21, 2019, 18:29 Matteo Alessandroni <sk...@apache.org>
wrote:

>
>
> On 21/02/19 16:43, Martin Grigorov wrote:
> > On Thu, Feb 21, 2019 at 5:35 PM Matteo Alessandroni <
> skylark17@apache.org>
> > wrote:
> >
> >>
> >> On 21/02/19 16:30, Martin Grigorov wrote:
> >>> On Thu, Feb 21, 2019 at 5:24 PM Matteo Alessandroni <
> >> skylark17@apache.org>
> >>> wrote:
> >>>
> >>>> On 21/02/19 16:07, Martin Grigorov wrote:
> >>>>> On Thu, Feb 21, 2019 at 4:41 PM Matteo Alessandroni <
> >>>> skylark17@apache.org>
> >>>>> wrote:
> >>>>>
> >>>>>> On 21/02/19 12:14, Martin Grigorov wrote:
> >>>>>>> On Thu, Feb 21, 2019 at 12:11 PM Matteo Alessandroni <
> >>>>>>> matteo.alessandroni@tirasa.net> wrote:
> >>>>>>>
> >>>>>>>> Hi,
> >>>>>>>>
> >>>>>>>> On 21/02/19 11:05, Martin Grigorov wrote:
> >>>>>>>>> When the WebSocket connection is established (maybe when the page
> >> is
> >>>>>>>>> loaded) you should see an entry in the Network tab.
> >>>>>>>>> If you select this entry then on the right-side you should see
> any
> >> WS
> >>>>>>>>> messages to/from the server.
> >>>>>>>> Yes I know how about WS debugging, but I do not see any WS request
> >>>> (with
> >>>>>>>> WS devtool filter and without it).
> >>>>>>>>
> >>>>>>> Maybe this is the problem.
> >>>>>>> If there is no WebSocket response at all then there is no way the
> JS
> >>>> code
> >>>>>>> to be executed.
> >>>>>>>
> >>>>>>> But since your WebSocketBehavior callback method is executed then
> >> there
> >>>>>>> must be an established WebSocket connection.
> >>>>>>> I have no idea what goes wrong.
> >>>>>> It is strange because in our application version that uses Wicket
> 7.x
> >> I
> >>>>>> see no WS requests in DevTools console as well, but the code is
> >>>>>> correctly executed and everything works.
> >>>>>> Yes the WebSocket connection seems to be established anyway in both
> >> our
> >>>>>> versions so with both Wicket 7.x and 8.x, but for some reason the
> >>>>>> "appendJavaScript()" method does not work on the
> >>>>>> "WebSocketRequestHandler" object with Wicket 8.x.
> >>>>>>
> >>>>>> Is there anything else we can try to make it work?
> >>>>>>
> >>>>> Put a breakpoint at
> >>>>>
> >>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
> >>>>> and see whether it is called.
> >>>>> And another one at
> >>>>>
> >>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86
> >>>>> to see whether the XML response is being written back to the browser
> in
> >>>> the
> >>>>> WebSocketConnection.
> >>>> Thanks!
> >>>> Ok the first method [1] was called many times and once was the one I'm
> >>>> interested on where the "script" variable was:
> >>>>
> >>>>
> >>>>
> >>
> "window.Wicket.WebSocket.send('{"kind":"ADD_ENDPOINT","target":"...","source":"...","scope":"..."}');"
> >>>> also the second one [2] was called, but *only once* and both the
> "text"
> >>>> and "binary" variables were null.
> >>>>
> >>> What is the type of "response" variable at
> >>>
> >>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
> >>> ?
> >>> It seems it is not WebSocketResponse
> >> Ideed, it's "StringResponse"!
> >> And it's content is something like this:
> >>
> > I didn't expect this!
> > Can you please put a breakpoint
> > at org.apache.wicket.response.StringResponse#StringResponse() (the
> > constructor) and see where it is instantiated.
> > AjaxRequestHandler uses StringResponse, but WebSocketRequestHandler does
> > not.
>
> I'm not completely sure but it seems that all the times the application
> enters in [1] (including when "script" contains "addEnpoint(...)") and
> then the "StringResponse()" constructor is called, the source is [2].
>
> [1]
>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
> [2]
>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestHandler.java#L360


It seems WebSocketRequestHandler#respond() is not called at all.
Put a breakpoint in AbstractWebSocketProcessor and see what happens there.



>
> >
> >> <?xml version="1.0" encoding="UTF-8"?><ajax-response><component
> >> id="id178" ><![CDATA[<span id="id178">
> >> <div class="wizard-form">
> >> <div id="id204">
> >> <div class="wizard-overview">
> >>
> >> </div>
> >> <div class="wizard-header">
> >> <div>
> >> <div>
> >> <div class="wizard-step-title">
> >> <div></div>
> >> </div>
> >> <div class="wizard-step-summary">
> >> <div></div>
> >> </div>
> >> </div>
> >> </div>
> >> </div>
> >> <div class="wizard-view">
> >> <div id="id207">
> >> <span id="id226">
> >> <span id="id227">
> >>
> >> ...
> >>
> >>>
> >>>> [1]
> >>>>
> >>>>
> >>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
> >>>> [2]
> >>>>
> >>>>
> >>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86
> >>>>>> Thanks
> >>>>>>
> >>>>>>>>> What is the type of resourceCreateEvent.getTarget() ?
> >>>>>>>>> Is it WebSocketRequestHandler or AjaxRequestHandler ?
> >>>>>>>> "resourceCreateEvent.getTarget()"type is "AjaxRequestHandler".
> >>>>>>>>
> >>>>>>>>>> [1]
> >>>>>>>>>>
> >>>>>>>>>>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
> >>>>>>>>>> On 21/02/19 10:01, Martin Grigorov wrote:
> >>>>>>>>>>> Hi,
> >>>>>>>>>>>
> >>>>>>>>>>> Check the browser's Dev Tools' console for any JavaScript
> errors.
> >>>>>>>>>>> If there are no errors then check in the DevTools Network tab
> >>>> whether
> >>>>>>>> the
> >>>>>>>>>>> WebSocket response frame contains the JS code in its body. It
> >> must
> >>>> be
> >>>>>>>>>>> inside <execution> XML element. If it is not there at all then
> it
> >>>>>> must
> >>>>>>>> be
> >>>>>>>>>>> something on the server side.
> >>>>>>>>>>>
> >>>>>>>>>>> On Thu, Feb 21, 2019 at 10:54 AM Matteo Alessandroni <
> >>>>>>>>>> skylark17@apache.org>
> >>>>>>>>>>> wrote:
> >>>>>>>>>>>
> >>>>>>>>>>>> Hi,
> >>>>>>>>>>>>
> >>>>>>>>>>>> we have a logic where a websocket message is sent from an
> >>>>>> "onEvent()"
> >>>>>>>>>>>> method [1] and catched in a WebSocketBehavior class [2].
> >>>>>>>>>>>> Then, a call to a js method "addEndpoint()"[3] must be
> executed.
> >>>>>>>>>>>> Our problem is that the js code "addEndpoint(...)" inside
> >>>>>>>>>>>> "handler.appendJavaScript(...)" [4] is not executed, so the
> code
> >>>>>>>>>>>> correctly reaches that switch case but it's like the
> >>>>>>>>>>>> "appendJavaScript(...)" is not working.
> >>>>>>>>>>>>
> >>>>>>>>>>>> On our application v2.0.x that code works and it uses Wicket
> >> 7.x,
> >>>>>>>> while
> >>>>>>>>>>>> the newer v2.1.x  uses Wicket 8.x and it does not work.
> >>>>>>>>>>>>
> >>>>>>>>>>>> Could you please give us an hint of this? Is there anything we
> >> are
> >>>>>>>>>>>> missing to make it work for Wicket 8.x?
> >>>>>>>>>>>>
> >>>>>>>>>>>> Thank you!
> >>>>>>>>>>>>
> >>>>>>>>>>>>
> >>>>>>>>>>>> [1]
> >>>>>>>>>>>>
> >>>>>>>>>>>>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
> >>>>>>>>>>>> [2]
> >>>>>>>>>>>>
> >>>>>>>>>>>>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L153-L157
> >>>>>>>>>>>> [3]
> >>>>>>>>>>>>
> >>>>>>>>>>>>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/resources/META-INF/resources/js/topology.js#L269-L280
> >>>>>>>>>>>> [4]
> >>>>>>>>>>>>
> >>>>>>>>>>>>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L154
> >>>>>>>>>>>> --
> >>>>>>>>>>>>
> >>>>>>>>>>>> Dott. Matteo Alessandroni
> >>>>>>>>>>>>
> >>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>>>>>>>
> >>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>>>>>>>
> >>>>>>>>>>>> http://www.tirasa.net
> >>>>>>>>>>>>
> >>>>>>>>>>>> Apache Syncope PMC Member
> >>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>>>>>>>
> >>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>>>>>>>
> >>>>>>>>>> --
> >>>>>>>>>>
> >>>>>>>>>> Dott. Matteo Alessandroni
> >>>>>>>>>>
> >>>>>>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>>>>>
> >>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>>>>>
> >>>>>>>>>> http://www.tirasa.net
> >>>>>>>>>>
> >>>>>>>>>> Apache Syncope PMC Member
> >>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>>>>>
> >>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>>>>>
> >>>>>>>> --
> >>>>>>>>
> >>>>>>>> Dott. Matteo Alessandroni
> >>>>>>>>
> >>>>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>>>
> >>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>>>
> >>>>>>>> http://www.tirasa.net
> >>>>>>>>
> >>>>>>>> Apache Syncope PMC Member
> >>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>>>
> >>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>>>
> >>>>>> --
> >>>>>>
> >>>>>> Dott. Matteo Alessandroni
> >>>>>>
> >>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>
> >>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>
> >>>>>> http://www.tirasa.net
> >>>>>>
> >>>>>> Apache Syncope PMC Member
> >>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>
> >>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>
> >>>> --
> >>>>
> >>>> Dott. Matteo Alessandroni
> >>>>
> >>>> Software Engineer @ Tirasa S.r.l.
> >>>>
> >>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>
> >>>> http://www.tirasa.net
> >>>>
> >>>> Apache Syncope PMC Member
> >>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>
> >>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>
> >> --
> >>
> >> Dott. Matteo Alessandroni
> >>
> >> Software Engineer @ Tirasa S.r.l.
> >>
> >> Viale Vittoria Colonna, 97 - 65127 Pescara
> >> Tel +39 0859116307 / FAX +39 0859111173
> >>
> >> http://www.tirasa.net
> >>
> >> Apache Syncope PMC Member
> >> http://people.apache.org/phonebook.html?uid=skylark17
> >> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>
> >> Tirasa S.r.l. <http://www.tirasa.net>
> >>
>
> --
>
> Dott. Matteo Alessandroni
>
> Software Engineer @ Tirasa S.r.l.
>
> Viale Vittoria Colonna, 97 - 65127 Pescara
> Tel +39 0859116307 / FAX +39 0859111173
>
> http://www.tirasa.net
>
> Apache Syncope PMC Member
> http://people.apache.org/phonebook.html?uid=skylark17
> <http://people.apache.org/phonebook.html?uid=skylark17>
>
> Tirasa S.r.l. <http://www.tirasa.net>
>

Re: WebSocketRequestHandler object not executing javascript code

Posted by Matteo Alessandroni <sk...@apache.org>.

On 21/02/19 16:43, Martin Grigorov wrote:
> On Thu, Feb 21, 2019 at 5:35 PM Matteo Alessandroni <sk...@apache.org>
> wrote:
>
>>
>> On 21/02/19 16:30, Martin Grigorov wrote:
>>> On Thu, Feb 21, 2019 at 5:24 PM Matteo Alessandroni <
>> skylark17@apache.org>
>>> wrote:
>>>
>>>> On 21/02/19 16:07, Martin Grigorov wrote:
>>>>> On Thu, Feb 21, 2019 at 4:41 PM Matteo Alessandroni <
>>>> skylark17@apache.org>
>>>>> wrote:
>>>>>
>>>>>> On 21/02/19 12:14, Martin Grigorov wrote:
>>>>>>> On Thu, Feb 21, 2019 at 12:11 PM Matteo Alessandroni <
>>>>>>> matteo.alessandroni@tirasa.net> wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> On 21/02/19 11:05, Martin Grigorov wrote:
>>>>>>>>> When the WebSocket connection is established (maybe when the page
>> is
>>>>>>>>> loaded) you should see an entry in the Network tab.
>>>>>>>>> If you select this entry then on the right-side you should see any
>> WS
>>>>>>>>> messages to/from the server.
>>>>>>>> Yes I know how about WS debugging, but I do not see any WS request
>>>> (with
>>>>>>>> WS devtool filter and without it).
>>>>>>>>
>>>>>>> Maybe this is the problem.
>>>>>>> If there is no WebSocket response at all then there is no way the JS
>>>> code
>>>>>>> to be executed.
>>>>>>>
>>>>>>> But since your WebSocketBehavior callback method is executed then
>> there
>>>>>>> must be an established WebSocket connection.
>>>>>>> I have no idea what goes wrong.
>>>>>> It is strange because in our application version that uses Wicket 7.x
>> I
>>>>>> see no WS requests in DevTools console as well, but the code is
>>>>>> correctly executed and everything works.
>>>>>> Yes the WebSocket connection seems to be established anyway in both
>> our
>>>>>> versions so with both Wicket 7.x and 8.x, but for some reason the
>>>>>> "appendJavaScript()" method does not work on the
>>>>>> "WebSocketRequestHandler" object with Wicket 8.x.
>>>>>>
>>>>>> Is there anything else we can try to make it work?
>>>>>>
>>>>> Put a breakpoint at
>>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
>>>>> and see whether it is called.
>>>>> And another one at
>>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86
>>>>> to see whether the XML response is being written back to the browser in
>>>> the
>>>>> WebSocketConnection.
>>>> Thanks!
>>>> Ok the first method [1] was called many times and once was the one I'm
>>>> interested on where the "script" variable was:
>>>>
>>>>
>>>>
>> "window.Wicket.WebSocket.send('{"kind":"ADD_ENDPOINT","target":"...","source":"...","scope":"..."}');"
>>>> also the second one [2] was called, but *only once* and both the "text"
>>>> and "binary" variables were null.
>>>>
>>> What is the type of "response" variable at
>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
>>> ?
>>> It seems it is not WebSocketResponse
>> Ideed, it's "StringResponse"!
>> And it's content is something like this:
>>
> I didn't expect this!
> Can you please put a breakpoint
> at org.apache.wicket.response.StringResponse#StringResponse() (the
> constructor) and see where it is instantiated.
> AjaxRequestHandler uses StringResponse, but WebSocketRequestHandler does
> not.

I'm not completely sure but it seems that all the times the application 
enters in [1] (including when "script" contains "addEnpoint(...)") and 
then the "StringResponse()" constructor is called, the source is [2].

[1] 
https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
[2] 
https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestHandler.java#L360

>
>> <?xml version="1.0" encoding="UTF-8"?><ajax-response><component
>> id="id178" ><![CDATA[<span id="id178">
>> <div class="wizard-form">
>> <div id="id204">
>> <div class="wizard-overview">
>>
>> </div>
>> <div class="wizard-header">
>> <div>
>> <div>
>> <div class="wizard-step-title">
>> <div></div>
>> </div>
>> <div class="wizard-step-summary">
>> <div></div>
>> </div>
>> </div>
>> </div>
>> </div>
>> <div class="wizard-view">
>> <div id="id207">
>> <span id="id226">
>> <span id="id227">
>>
>> ...
>>
>>>
>>>> [1]
>>>>
>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
>>>> [2]
>>>>
>>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86
>>>>>> Thanks
>>>>>>
>>>>>>>>> What is the type of resourceCreateEvent.getTarget() ?
>>>>>>>>> Is it WebSocketRequestHandler or AjaxRequestHandler ?
>>>>>>>> "resourceCreateEvent.getTarget()"type is "AjaxRequestHandler".
>>>>>>>>
>>>>>>>>>> [1]
>>>>>>>>>>
>>>>>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
>>>>>>>>>> On 21/02/19 10:01, Martin Grigorov wrote:
>>>>>>>>>>> Hi,
>>>>>>>>>>>
>>>>>>>>>>> Check the browser's Dev Tools' console for any JavaScript errors.
>>>>>>>>>>> If there are no errors then check in the DevTools Network tab
>>>> whether
>>>>>>>> the
>>>>>>>>>>> WebSocket response frame contains the JS code in its body. It
>> must
>>>> be
>>>>>>>>>>> inside <execution> XML element. If it is not there at all then it
>>>>>> must
>>>>>>>> be
>>>>>>>>>>> something on the server side.
>>>>>>>>>>>
>>>>>>>>>>> On Thu, Feb 21, 2019 at 10:54 AM Matteo Alessandroni <
>>>>>>>>>> skylark17@apache.org>
>>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hi,
>>>>>>>>>>>>
>>>>>>>>>>>> we have a logic where a websocket message is sent from an
>>>>>> "onEvent()"
>>>>>>>>>>>> method [1] and catched in a WebSocketBehavior class [2].
>>>>>>>>>>>> Then, a call to a js method "addEndpoint()"[3] must be executed.
>>>>>>>>>>>> Our problem is that the js code "addEndpoint(...)" inside
>>>>>>>>>>>> "handler.appendJavaScript(...)" [4] is not executed, so the code
>>>>>>>>>>>> correctly reaches that switch case but it's like the
>>>>>>>>>>>> "appendJavaScript(...)" is not working.
>>>>>>>>>>>>
>>>>>>>>>>>> On our application v2.0.x that code works and it uses Wicket
>> 7.x,
>>>>>>>> while
>>>>>>>>>>>> the newer v2.1.x  uses Wicket 8.x and it does not work.
>>>>>>>>>>>>
>>>>>>>>>>>> Could you please give us an hint of this? Is there anything we
>> are
>>>>>>>>>>>> missing to make it work for Wicket 8.x?
>>>>>>>>>>>>
>>>>>>>>>>>> Thank you!
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> [1]
>>>>>>>>>>>>
>>>>>>>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
>>>>>>>>>>>> [2]
>>>>>>>>>>>>
>>>>>>>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L153-L157
>>>>>>>>>>>> [3]
>>>>>>>>>>>>
>>>>>>>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/resources/META-INF/resources/js/topology.js#L269-L280
>>>>>>>>>>>> [4]
>>>>>>>>>>>>
>>>>>>>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L154
>>>>>>>>>>>> --
>>>>>>>>>>>>
>>>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>>>
>>>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>>>
>>>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>>>
>>>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>>>
>>>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>>>
>>>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>>
>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>
>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>
>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>
>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>
>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>
>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>
>>>>>>>> --
>>>>>>>>
>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>
>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>
>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>
>>>>>>>> http://www.tirasa.net
>>>>>>>>
>>>>>>>> Apache Syncope PMC Member
>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>
>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>
>>>>>> --
>>>>>>
>>>>>> Dott. Matteo Alessandroni
>>>>>>
>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>
>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>
>>>>>> http://www.tirasa.net
>>>>>>
>>>>>> Apache Syncope PMC Member
>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>
>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>
>>>> --
>>>>
>>>> Dott. Matteo Alessandroni
>>>>
>>>> Software Engineer @ Tirasa S.r.l.
>>>>
>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>
>>>> http://www.tirasa.net
>>>>
>>>> Apache Syncope PMC Member
>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>
>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>
>> --
>>
>> Dott. Matteo Alessandroni
>>
>> Software Engineer @ Tirasa S.r.l.
>>
>> Viale Vittoria Colonna, 97 - 65127 Pescara
>> Tel +39 0859116307 / FAX +39 0859111173
>>
>> http://www.tirasa.net
>>
>> Apache Syncope PMC Member
>> http://people.apache.org/phonebook.html?uid=skylark17
>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>
>> Tirasa S.r.l. <http://www.tirasa.net>
>>

-- 

Dott. Matteo Alessandroni

Software Engineer @ Tirasa S.r.l.

Viale Vittoria Colonna, 97 - 65127 Pescara
Tel +39 0859116307 / FAX +39 0859111173

http://www.tirasa.net

Apache Syncope PMC Member
http://people.apache.org/phonebook.html?uid=skylark17 
<http://people.apache.org/phonebook.html?uid=skylark17>

Tirasa S.r.l. <http://www.tirasa.net>

Re: WebSocketRequestHandler object not executing javascript code

Posted by Martin Grigorov <mg...@apache.org>.
On Thu, Feb 21, 2019 at 5:35 PM Matteo Alessandroni <sk...@apache.org>
wrote:

>
>
> On 21/02/19 16:30, Martin Grigorov wrote:
> > On Thu, Feb 21, 2019 at 5:24 PM Matteo Alessandroni <
> skylark17@apache.org>
> > wrote:
> >
> >> On 21/02/19 16:07, Martin Grigorov wrote:
> >>> On Thu, Feb 21, 2019 at 4:41 PM Matteo Alessandroni <
> >> skylark17@apache.org>
> >>> wrote:
> >>>
> >>>> On 21/02/19 12:14, Martin Grigorov wrote:
> >>>>> On Thu, Feb 21, 2019 at 12:11 PM Matteo Alessandroni <
> >>>>> matteo.alessandroni@tirasa.net> wrote:
> >>>>>
> >>>>>> Hi,
> >>>>>>
> >>>>>> On 21/02/19 11:05, Martin Grigorov wrote:
> >>>>>>> When the WebSocket connection is established (maybe when the page
> is
> >>>>>>> loaded) you should see an entry in the Network tab.
> >>>>>>> If you select this entry then on the right-side you should see any
> WS
> >>>>>>> messages to/from the server.
> >>>>>> Yes I know how about WS debugging, but I do not see any WS request
> >> (with
> >>>>>> WS devtool filter and without it).
> >>>>>>
> >>>>> Maybe this is the problem.
> >>>>> If there is no WebSocket response at all then there is no way the JS
> >> code
> >>>>> to be executed.
> >>>>>
> >>>>> But since your WebSocketBehavior callback method is executed then
> there
> >>>>> must be an established WebSocket connection.
> >>>>> I have no idea what goes wrong.
> >>>> It is strange because in our application version that uses Wicket 7.x
> I
> >>>> see no WS requests in DevTools console as well, but the code is
> >>>> correctly executed and everything works.
> >>>> Yes the WebSocket connection seems to be established anyway in both
> our
> >>>> versions so with both Wicket 7.x and 8.x, but for some reason the
> >>>> "appendJavaScript()" method does not work on the
> >>>> "WebSocketRequestHandler" object with Wicket 8.x.
> >>>>
> >>>> Is there anything else we can try to make it work?
> >>>>
> >>> Put a breakpoint at
> >>>
> >>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
> >>> and see whether it is called.
> >>> And another one at
> >>>
> >>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86
> >>> to see whether the XML response is being written back to the browser in
> >> the
> >>> WebSocketConnection.
> >> Thanks!
> >> Ok the first method [1] was called many times and once was the one I'm
> >> interested on where the "script" variable was:
> >>
> >>
> >>
> "window.Wicket.WebSocket.send('{"kind":"ADD_ENDPOINT","target":"...","source":"...","scope":"..."}');"
> >>
> >> also the second one [2] was called, but *only once* and both the "text"
> >> and "binary" variables were null.
> >>
> > What is the type of "response" variable at
> >
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
> > ?
> > It seems it is not WebSocketResponse
>
> Ideed, it's "StringResponse"!
> And it's content is something like this:
>

I didn't expect this!
Can you please put a breakpoint
at org.apache.wicket.response.StringResponse#StringResponse() (the
constructor) and see where it is instantiated.
AjaxRequestHandler uses StringResponse, but WebSocketRequestHandler does
not.


>
> <?xml version="1.0" encoding="UTF-8"?><ajax-response><component
> id="id178" ><![CDATA[<span id="id178">
> <div class="wizard-form">
> <div id="id204">
> <div class="wizard-overview">
>
> </div>
> <div class="wizard-header">
> <div>
> <div>
> <div class="wizard-step-title">
> <div></div>
> </div>
> <div class="wizard-step-summary">
> <div></div>
> </div>
> </div>
> </div>
> </div>
> <div class="wizard-view">
> <div id="id207">
> <span id="id226">
> <span id="id227">
>
> ...
>
> >
> >
> >>
> >> [1]
> >>
> >>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
> >> [2]
> >>
> >>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86
> >>
> >>>> Thanks
> >>>>
> >>>>>>> What is the type of resourceCreateEvent.getTarget() ?
> >>>>>>> Is it WebSocketRequestHandler or AjaxRequestHandler ?
> >>>>>> "resourceCreateEvent.getTarget()"type is "AjaxRequestHandler".
> >>>>>>
> >>>>>>>> [1]
> >>>>>>>>
> >>>>>>>>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
> >>>>>>>> On 21/02/19 10:01, Martin Grigorov wrote:
> >>>>>>>>> Hi,
> >>>>>>>>>
> >>>>>>>>> Check the browser's Dev Tools' console for any JavaScript errors.
> >>>>>>>>> If there are no errors then check in the DevTools Network tab
> >> whether
> >>>>>> the
> >>>>>>>>> WebSocket response frame contains the JS code in its body. It
> must
> >> be
> >>>>>>>>> inside <execution> XML element. If it is not there at all then it
> >>>> must
> >>>>>> be
> >>>>>>>>> something on the server side.
> >>>>>>>>>
> >>>>>>>>> On Thu, Feb 21, 2019 at 10:54 AM Matteo Alessandroni <
> >>>>>>>> skylark17@apache.org>
> >>>>>>>>> wrote:
> >>>>>>>>>
> >>>>>>>>>> Hi,
> >>>>>>>>>>
> >>>>>>>>>> we have a logic where a websocket message is sent from an
> >>>> "onEvent()"
> >>>>>>>>>> method [1] and catched in a WebSocketBehavior class [2].
> >>>>>>>>>> Then, a call to a js method "addEndpoint()"[3] must be executed.
> >>>>>>>>>> Our problem is that the js code "addEndpoint(...)" inside
> >>>>>>>>>> "handler.appendJavaScript(...)" [4] is not executed, so the code
> >>>>>>>>>> correctly reaches that switch case but it's like the
> >>>>>>>>>> "appendJavaScript(...)" is not working.
> >>>>>>>>>>
> >>>>>>>>>> On our application v2.0.x that code works and it uses Wicket
> 7.x,
> >>>>>> while
> >>>>>>>>>> the newer v2.1.x  uses Wicket 8.x and it does not work.
> >>>>>>>>>>
> >>>>>>>>>> Could you please give us an hint of this? Is there anything we
> are
> >>>>>>>>>> missing to make it work for Wicket 8.x?
> >>>>>>>>>>
> >>>>>>>>>> Thank you!
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>> [1]
> >>>>>>>>>>
> >>>>>>>>>>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
> >>>>>>>>>> [2]
> >>>>>>>>>>
> >>>>>>>>>>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L153-L157
> >>>>>>>>>> [3]
> >>>>>>>>>>
> >>>>>>>>>>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/resources/META-INF/resources/js/topology.js#L269-L280
> >>>>>>>>>> [4]
> >>>>>>>>>>
> >>>>>>>>>>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L154
> >>>>>>>>>> --
> >>>>>>>>>>
> >>>>>>>>>> Dott. Matteo Alessandroni
> >>>>>>>>>>
> >>>>>>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>>>>>
> >>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>>>>>
> >>>>>>>>>> http://www.tirasa.net
> >>>>>>>>>>
> >>>>>>>>>> Apache Syncope PMC Member
> >>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>>>>>
> >>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>>>>>
> >>>>>>>> --
> >>>>>>>>
> >>>>>>>> Dott. Matteo Alessandroni
> >>>>>>>>
> >>>>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>>>
> >>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>>>
> >>>>>>>> http://www.tirasa.net
> >>>>>>>>
> >>>>>>>> Apache Syncope PMC Member
> >>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>>>
> >>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>>>
> >>>>>> --
> >>>>>>
> >>>>>> Dott. Matteo Alessandroni
> >>>>>>
> >>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>
> >>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>
> >>>>>> http://www.tirasa.net
> >>>>>>
> >>>>>> Apache Syncope PMC Member
> >>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>
> >>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>
> >>>> --
> >>>>
> >>>> Dott. Matteo Alessandroni
> >>>>
> >>>> Software Engineer @ Tirasa S.r.l.
> >>>>
> >>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>
> >>>> http://www.tirasa.net
> >>>>
> >>>> Apache Syncope PMC Member
> >>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>
> >>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>
> >> --
> >>
> >> Dott. Matteo Alessandroni
> >>
> >> Software Engineer @ Tirasa S.r.l.
> >>
> >> Viale Vittoria Colonna, 97 - 65127 Pescara
> >> Tel +39 0859116307 / FAX +39 0859111173
> >>
> >> http://www.tirasa.net
> >>
> >> Apache Syncope PMC Member
> >> http://people.apache.org/phonebook.html?uid=skylark17
> >> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>
> >> Tirasa S.r.l. <http://www.tirasa.net>
> >>
>
> --
>
> Dott. Matteo Alessandroni
>
> Software Engineer @ Tirasa S.r.l.
>
> Viale Vittoria Colonna, 97 - 65127 Pescara
> Tel +39 0859116307 / FAX +39 0859111173
>
> http://www.tirasa.net
>
> Apache Syncope PMC Member
> http://people.apache.org/phonebook.html?uid=skylark17
> <http://people.apache.org/phonebook.html?uid=skylark17>
>
> Tirasa S.r.l. <http://www.tirasa.net>
>

Re: WebSocketRequestHandler object not executing javascript code

Posted by Matteo Alessandroni <sk...@apache.org>.

On 21/02/19 16:30, Martin Grigorov wrote:
> On Thu, Feb 21, 2019 at 5:24 PM Matteo Alessandroni <sk...@apache.org>
> wrote:
>
>> On 21/02/19 16:07, Martin Grigorov wrote:
>>> On Thu, Feb 21, 2019 at 4:41 PM Matteo Alessandroni <
>> skylark17@apache.org>
>>> wrote:
>>>
>>>> On 21/02/19 12:14, Martin Grigorov wrote:
>>>>> On Thu, Feb 21, 2019 at 12:11 PM Matteo Alessandroni <
>>>>> matteo.alessandroni@tirasa.net> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> On 21/02/19 11:05, Martin Grigorov wrote:
>>>>>>> When the WebSocket connection is established (maybe when the page is
>>>>>>> loaded) you should see an entry in the Network tab.
>>>>>>> If you select this entry then on the right-side you should see any WS
>>>>>>> messages to/from the server.
>>>>>> Yes I know how about WS debugging, but I do not see any WS request
>> (with
>>>>>> WS devtool filter and without it).
>>>>>>
>>>>> Maybe this is the problem.
>>>>> If there is no WebSocket response at all then there is no way the JS
>> code
>>>>> to be executed.
>>>>>
>>>>> But since your WebSocketBehavior callback method is executed then there
>>>>> must be an established WebSocket connection.
>>>>> I have no idea what goes wrong.
>>>> It is strange because in our application version that uses Wicket 7.x I
>>>> see no WS requests in DevTools console as well, but the code is
>>>> correctly executed and everything works.
>>>> Yes the WebSocket connection seems to be established anyway in both our
>>>> versions so with both Wicket 7.x and 8.x, but for some reason the
>>>> "appendJavaScript()" method does not work on the
>>>> "WebSocketRequestHandler" object with Wicket 8.x.
>>>>
>>>> Is there anything else we can try to make it work?
>>>>
>>> Put a breakpoint at
>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
>>> and see whether it is called.
>>> And another one at
>>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86
>>> to see whether the XML response is being written back to the browser in
>> the
>>> WebSocketConnection.
>> Thanks!
>> Ok the first method [1] was called many times and once was the one I'm
>> interested on where the "script" variable was:
>>
>>
>> "window.Wicket.WebSocket.send('{"kind":"ADD_ENDPOINT","target":"...","source":"...","scope":"..."}');"
>>
>> also the second one [2] was called, but *only once* and both the "text"
>> and "binary" variables were null.
>>
> What is the type of "response" variable at
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
> ?
> It seems it is not WebSocketResponse

Ideed, it's "StringResponse"!
And it's content is something like this:

<?xml version="1.0" encoding="UTF-8"?><ajax-response><component 
id="id178" ><![CDATA[<span id="id178">
<div class="wizard-form">
<div id="id204">
<div class="wizard-overview">

</div>
<div class="wizard-header">
<div>
<div>
<div class="wizard-step-title">
<div></div>
</div>
<div class="wizard-step-summary">
<div></div>
</div>
</div>
</div>
</div>
<div class="wizard-view">
<div id="id207">
<span id="id226">
<span id="id227">

...

>
>
>>
>> [1]
>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
>> [2]
>>
>> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86
>>
>>>> Thanks
>>>>
>>>>>>> What is the type of resourceCreateEvent.getTarget() ?
>>>>>>> Is it WebSocketRequestHandler or AjaxRequestHandler ?
>>>>>> "resourceCreateEvent.getTarget()"type is "AjaxRequestHandler".
>>>>>>
>>>>>>>> [1]
>>>>>>>>
>>>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
>>>>>>>> On 21/02/19 10:01, Martin Grigorov wrote:
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> Check the browser's Dev Tools' console for any JavaScript errors.
>>>>>>>>> If there are no errors then check in the DevTools Network tab
>> whether
>>>>>> the
>>>>>>>>> WebSocket response frame contains the JS code in its body. It must
>> be
>>>>>>>>> inside <execution> XML element. If it is not there at all then it
>>>> must
>>>>>> be
>>>>>>>>> something on the server side.
>>>>>>>>>
>>>>>>>>> On Thu, Feb 21, 2019 at 10:54 AM Matteo Alessandroni <
>>>>>>>> skylark17@apache.org>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> we have a logic where a websocket message is sent from an
>>>> "onEvent()"
>>>>>>>>>> method [1] and catched in a WebSocketBehavior class [2].
>>>>>>>>>> Then, a call to a js method "addEndpoint()"[3] must be executed.
>>>>>>>>>> Our problem is that the js code "addEndpoint(...)" inside
>>>>>>>>>> "handler.appendJavaScript(...)" [4] is not executed, so the code
>>>>>>>>>> correctly reaches that switch case but it's like the
>>>>>>>>>> "appendJavaScript(...)" is not working.
>>>>>>>>>>
>>>>>>>>>> On our application v2.0.x that code works and it uses Wicket 7.x,
>>>>>> while
>>>>>>>>>> the newer v2.1.x  uses Wicket 8.x and it does not work.
>>>>>>>>>>
>>>>>>>>>> Could you please give us an hint of this? Is there anything we are
>>>>>>>>>> missing to make it work for Wicket 8.x?
>>>>>>>>>>
>>>>>>>>>> Thank you!
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> [1]
>>>>>>>>>>
>>>>>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
>>>>>>>>>> [2]
>>>>>>>>>>
>>>>>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L153-L157
>>>>>>>>>> [3]
>>>>>>>>>>
>>>>>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/resources/META-INF/resources/js/topology.js#L269-L280
>>>>>>>>>> [4]
>>>>>>>>>>
>>>>>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L154
>>>>>>>>>> --
>>>>>>>>>>
>>>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>>>
>>>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>>>
>>>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>>>
>>>>>>>>>> http://www.tirasa.net
>>>>>>>>>>
>>>>>>>>>> Apache Syncope PMC Member
>>>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>>>
>>>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>>>
>>>>>>>> --
>>>>>>>>
>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>
>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>
>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>
>>>>>>>> http://www.tirasa.net
>>>>>>>>
>>>>>>>> Apache Syncope PMC Member
>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>
>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>
>>>>>> --
>>>>>>
>>>>>> Dott. Matteo Alessandroni
>>>>>>
>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>
>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>
>>>>>> http://www.tirasa.net
>>>>>>
>>>>>> Apache Syncope PMC Member
>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>
>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>
>>>> --
>>>>
>>>> Dott. Matteo Alessandroni
>>>>
>>>> Software Engineer @ Tirasa S.r.l.
>>>>
>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>
>>>> http://www.tirasa.net
>>>>
>>>> Apache Syncope PMC Member
>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>
>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>
>> --
>>
>> Dott. Matteo Alessandroni
>>
>> Software Engineer @ Tirasa S.r.l.
>>
>> Viale Vittoria Colonna, 97 - 65127 Pescara
>> Tel +39 0859116307 / FAX +39 0859111173
>>
>> http://www.tirasa.net
>>
>> Apache Syncope PMC Member
>> http://people.apache.org/phonebook.html?uid=skylark17
>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>
>> Tirasa S.r.l. <http://www.tirasa.net>
>>

-- 

Dott. Matteo Alessandroni

Software Engineer @ Tirasa S.r.l.

Viale Vittoria Colonna, 97 - 65127 Pescara
Tel +39 0859116307 / FAX +39 0859111173

http://www.tirasa.net

Apache Syncope PMC Member
http://people.apache.org/phonebook.html?uid=skylark17 
<http://people.apache.org/phonebook.html?uid=skylark17>

Tirasa S.r.l. <http://www.tirasa.net>

Re: WebSocketRequestHandler object not executing javascript code

Posted by Martin Grigorov <mg...@apache.org>.
On Thu, Feb 21, 2019 at 5:24 PM Matteo Alessandroni <sk...@apache.org>
wrote:

> On 21/02/19 16:07, Martin Grigorov wrote:
> > On Thu, Feb 21, 2019 at 4:41 PM Matteo Alessandroni <
> skylark17@apache.org>
> > wrote:
> >
> >> On 21/02/19 12:14, Martin Grigorov wrote:
> >>> On Thu, Feb 21, 2019 at 12:11 PM Matteo Alessandroni <
> >>> matteo.alessandroni@tirasa.net> wrote:
> >>>
> >>>> Hi,
> >>>>
> >>>> On 21/02/19 11:05, Martin Grigorov wrote:
> >>>>> When the WebSocket connection is established (maybe when the page is
> >>>>> loaded) you should see an entry in the Network tab.
> >>>>> If you select this entry then on the right-side you should see any WS
> >>>>> messages to/from the server.
> >>>> Yes I know how about WS debugging, but I do not see any WS request
> (with
> >>>> WS devtool filter and without it).
> >>>>
> >>> Maybe this is the problem.
> >>> If there is no WebSocket response at all then there is no way the JS
> code
> >>> to be executed.
> >>>
> >>> But since your WebSocketBehavior callback method is executed then there
> >>> must be an established WebSocket connection.
> >>> I have no idea what goes wrong.
> >> It is strange because in our application version that uses Wicket 7.x I
> >> see no WS requests in DevTools console as well, but the code is
> >> correctly executed and everything works.
> >> Yes the WebSocket connection seems to be established anyway in both our
> >> versions so with both Wicket 7.x and 8.x, but for some reason the
> >> "appendJavaScript()" method does not work on the
> >> "WebSocketRequestHandler" object with Wicket 8.x.
> >>
> >> Is there anything else we can try to make it work?
> >>
> > Put a breakpoint at
> >
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
> > and see whether it is called.
> > And another one at
> >
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86
> > to see whether the XML response is being written back to the browser in
> the
> > WebSocketConnection.
>
> Thanks!
> Ok the first method [1] was called many times and once was the one I'm
> interested on where the "script" variable was:
>
>
> "window.Wicket.WebSocket.send('{"kind":"ADD_ENDPOINT","target":"...","source":"...","scope":"..."}');"
>
> also the second one [2] was called, but *only once* and both the "text"
> and "binary" variables were null.
>

What is the type of "response" variable at
https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
?
It seems it is not WebSocketResponse


>
>
> [1]
>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
> [2]
>
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86
>
> >
> >> Thanks
> >>
> >>>
> >>>>> What is the type of resourceCreateEvent.getTarget() ?
> >>>>> Is it WebSocketRequestHandler or AjaxRequestHandler ?
> >>>> "resourceCreateEvent.getTarget()"type is "AjaxRequestHandler".
> >>>>
> >>>>>> [1]
> >>>>>>
> >>>>>>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
> >>>>>> On 21/02/19 10:01, Martin Grigorov wrote:
> >>>>>>> Hi,
> >>>>>>>
> >>>>>>> Check the browser's Dev Tools' console for any JavaScript errors.
> >>>>>>> If there are no errors then check in the DevTools Network tab
> whether
> >>>> the
> >>>>>>> WebSocket response frame contains the JS code in its body. It must
> be
> >>>>>>> inside <execution> XML element. If it is not there at all then it
> >> must
> >>>> be
> >>>>>>> something on the server side.
> >>>>>>>
> >>>>>>> On Thu, Feb 21, 2019 at 10:54 AM Matteo Alessandroni <
> >>>>>> skylark17@apache.org>
> >>>>>>> wrote:
> >>>>>>>
> >>>>>>>> Hi,
> >>>>>>>>
> >>>>>>>> we have a logic where a websocket message is sent from an
> >> "onEvent()"
> >>>>>>>> method [1] and catched in a WebSocketBehavior class [2].
> >>>>>>>> Then, a call to a js method "addEndpoint()"[3] must be executed.
> >>>>>>>> Our problem is that the js code "addEndpoint(...)" inside
> >>>>>>>> "handler.appendJavaScript(...)" [4] is not executed, so the code
> >>>>>>>> correctly reaches that switch case but it's like the
> >>>>>>>> "appendJavaScript(...)" is not working.
> >>>>>>>>
> >>>>>>>> On our application v2.0.x that code works and it uses Wicket 7.x,
> >>>> while
> >>>>>>>> the newer v2.1.x  uses Wicket 8.x and it does not work.
> >>>>>>>>
> >>>>>>>> Could you please give us an hint of this? Is there anything we are
> >>>>>>>> missing to make it work for Wicket 8.x?
> >>>>>>>>
> >>>>>>>> Thank you!
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> [1]
> >>>>>>>>
> >>>>>>>>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
> >>>>>>>> [2]
> >>>>>>>>
> >>>>>>>>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L153-L157
> >>>>>>>> [3]
> >>>>>>>>
> >>>>>>>>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/resources/META-INF/resources/js/topology.js#L269-L280
> >>>>>>>> [4]
> >>>>>>>>
> >>>>>>>>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L154
> >>>>>>>> --
> >>>>>>>>
> >>>>>>>> Dott. Matteo Alessandroni
> >>>>>>>>
> >>>>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>>>
> >>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>>>
> >>>>>>>> http://www.tirasa.net
> >>>>>>>>
> >>>>>>>> Apache Syncope PMC Member
> >>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>>>
> >>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>>>
> >>>>>> --
> >>>>>>
> >>>>>> Dott. Matteo Alessandroni
> >>>>>>
> >>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>
> >>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>
> >>>>>> http://www.tirasa.net
> >>>>>>
> >>>>>> Apache Syncope PMC Member
> >>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>
> >>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>
> >>>> --
> >>>>
> >>>> Dott. Matteo Alessandroni
> >>>>
> >>>> Software Engineer @ Tirasa S.r.l.
> >>>>
> >>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>
> >>>> http://www.tirasa.net
> >>>>
> >>>> Apache Syncope PMC Member
> >>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>
> >>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>
> >> --
> >>
> >> Dott. Matteo Alessandroni
> >>
> >> Software Engineer @ Tirasa S.r.l.
> >>
> >> Viale Vittoria Colonna, 97 - 65127 Pescara
> >> Tel +39 0859116307 / FAX +39 0859111173
> >>
> >> http://www.tirasa.net
> >>
> >> Apache Syncope PMC Member
> >> http://people.apache.org/phonebook.html?uid=skylark17
> >> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>
> >> Tirasa S.r.l. <http://www.tirasa.net>
> >>
>
> --
>
> Dott. Matteo Alessandroni
>
> Software Engineer @ Tirasa S.r.l.
>
> Viale Vittoria Colonna, 97 - 65127 Pescara
> Tel +39 0859116307 / FAX +39 0859111173
>
> http://www.tirasa.net
>
> Apache Syncope PMC Member
> http://people.apache.org/phonebook.html?uid=skylark17
> <http://people.apache.org/phonebook.html?uid=skylark17>
>
> Tirasa S.r.l. <http://www.tirasa.net>
>

Re: WebSocketRequestHandler object not executing javascript code

Posted by Matteo Alessandroni <sk...@apache.org>.
On 21/02/19 16:07, Martin Grigorov wrote:
> On Thu, Feb 21, 2019 at 4:41 PM Matteo Alessandroni <sk...@apache.org>
> wrote:
>
>> On 21/02/19 12:14, Martin Grigorov wrote:
>>> On Thu, Feb 21, 2019 at 12:11 PM Matteo Alessandroni <
>>> matteo.alessandroni@tirasa.net> wrote:
>>>
>>>> Hi,
>>>>
>>>> On 21/02/19 11:05, Martin Grigorov wrote:
>>>>> When the WebSocket connection is established (maybe when the page is
>>>>> loaded) you should see an entry in the Network tab.
>>>>> If you select this entry then on the right-side you should see any WS
>>>>> messages to/from the server.
>>>> Yes I know how about WS debugging, but I do not see any WS request (with
>>>> WS devtool filter and without it).
>>>>
>>> Maybe this is the problem.
>>> If there is no WebSocket response at all then there is no way the JS code
>>> to be executed.
>>>
>>> But since your WebSocketBehavior callback method is executed then there
>>> must be an established WebSocket connection.
>>> I have no idea what goes wrong.
>> It is strange because in our application version that uses Wicket 7.x I
>> see no WS requests in DevTools console as well, but the code is
>> correctly executed and everything works.
>> Yes the WebSocket connection seems to be established anyway in both our
>> versions so with both Wicket 7.x and 8.x, but for some reason the
>> "appendJavaScript()" method does not work on the
>> "WebSocketRequestHandler" object with Wicket 8.x.
>>
>> Is there anything else we can try to make it work?
>>
> Put a breakpoint at
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
> and see whether it is called.
> And another one at
> https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86
> to see whether the XML response is being written back to the browser in the
> WebSocketConnection.

Thanks!
Ok the first method [1] was called many times and once was the one I'm 
interested on where the "script" variable was:

"window.Wicket.WebSocket.send('{"kind":"ADD_ENDPOINT","target":"...","source":"...","scope":"..."}');"

also the second one [2] was called, but *only once* and both the "text" 
and "binary" variables were null.


[1] 
https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
[2] 
https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86

>
>> Thanks
>>
>>>
>>>>> What is the type of resourceCreateEvent.getTarget() ?
>>>>> Is it WebSocketRequestHandler or AjaxRequestHandler ?
>>>> "resourceCreateEvent.getTarget()"type is "AjaxRequestHandler".
>>>>
>>>>>> [1]
>>>>>>
>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
>>>>>> On 21/02/19 10:01, Martin Grigorov wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> Check the browser's Dev Tools' console for any JavaScript errors.
>>>>>>> If there are no errors then check in the DevTools Network tab whether
>>>> the
>>>>>>> WebSocket response frame contains the JS code in its body. It must be
>>>>>>> inside <execution> XML element. If it is not there at all then it
>> must
>>>> be
>>>>>>> something on the server side.
>>>>>>>
>>>>>>> On Thu, Feb 21, 2019 at 10:54 AM Matteo Alessandroni <
>>>>>> skylark17@apache.org>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> we have a logic where a websocket message is sent from an
>> "onEvent()"
>>>>>>>> method [1] and catched in a WebSocketBehavior class [2].
>>>>>>>> Then, a call to a js method "addEndpoint()"[3] must be executed.
>>>>>>>> Our problem is that the js code "addEndpoint(...)" inside
>>>>>>>> "handler.appendJavaScript(...)" [4] is not executed, so the code
>>>>>>>> correctly reaches that switch case but it's like the
>>>>>>>> "appendJavaScript(...)" is not working.
>>>>>>>>
>>>>>>>> On our application v2.0.x that code works and it uses Wicket 7.x,
>>>> while
>>>>>>>> the newer v2.1.x  uses Wicket 8.x and it does not work.
>>>>>>>>
>>>>>>>> Could you please give us an hint of this? Is there anything we are
>>>>>>>> missing to make it work for Wicket 8.x?
>>>>>>>>
>>>>>>>> Thank you!
>>>>>>>>
>>>>>>>>
>>>>>>>> [1]
>>>>>>>>
>>>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
>>>>>>>> [2]
>>>>>>>>
>>>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L153-L157
>>>>>>>> [3]
>>>>>>>>
>>>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/resources/META-INF/resources/js/topology.js#L269-L280
>>>>>>>> [4]
>>>>>>>>
>>>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L154
>>>>>>>> --
>>>>>>>>
>>>>>>>> Dott. Matteo Alessandroni
>>>>>>>>
>>>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>>>
>>>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>>>
>>>>>>>> http://www.tirasa.net
>>>>>>>>
>>>>>>>> Apache Syncope PMC Member
>>>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>>>
>>>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>>>
>>>>>> --
>>>>>>
>>>>>> Dott. Matteo Alessandroni
>>>>>>
>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>
>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>
>>>>>> http://www.tirasa.net
>>>>>>
>>>>>> Apache Syncope PMC Member
>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>
>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>
>>>> --
>>>>
>>>> Dott. Matteo Alessandroni
>>>>
>>>> Software Engineer @ Tirasa S.r.l.
>>>>
>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>
>>>> http://www.tirasa.net
>>>>
>>>> Apache Syncope PMC Member
>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>
>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>
>> --
>>
>> Dott. Matteo Alessandroni
>>
>> Software Engineer @ Tirasa S.r.l.
>>
>> Viale Vittoria Colonna, 97 - 65127 Pescara
>> Tel +39 0859116307 / FAX +39 0859111173
>>
>> http://www.tirasa.net
>>
>> Apache Syncope PMC Member
>> http://people.apache.org/phonebook.html?uid=skylark17
>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>
>> Tirasa S.r.l. <http://www.tirasa.net>
>>

-- 

Dott. Matteo Alessandroni

Software Engineer @ Tirasa S.r.l.

Viale Vittoria Colonna, 97 - 65127 Pescara
Tel +39 0859116307 / FAX +39 0859111173

http://www.tirasa.net

Apache Syncope PMC Member
http://people.apache.org/phonebook.html?uid=skylark17 
<http://people.apache.org/phonebook.html?uid=skylark17>

Tirasa S.r.l. <http://www.tirasa.net>

Re: WebSocketRequestHandler object not executing javascript code

Posted by Martin Grigorov <mg...@apache.org>.
On Thu, Feb 21, 2019 at 4:41 PM Matteo Alessandroni <sk...@apache.org>
wrote:

> On 21/02/19 12:14, Martin Grigorov wrote:
> > On Thu, Feb 21, 2019 at 12:11 PM Matteo Alessandroni <
> > matteo.alessandroni@tirasa.net> wrote:
> >
> >> Hi,
> >>
> >> On 21/02/19 11:05, Martin Grigorov wrote:
> >>> When the WebSocket connection is established (maybe when the page is
> >>> loaded) you should see an entry in the Network tab.
> >>> If you select this entry then on the right-side you should see any WS
> >>> messages to/from the server.
> >> Yes I know how about WS debugging, but I do not see any WS request (with
> >> WS devtool filter and without it).
> >>
> > Maybe this is the problem.
> > If there is no WebSocket response at all then there is no way the JS code
> > to be executed.
> >
> > But since your WebSocketBehavior callback method is executed then there
> > must be an established WebSocket connection.
> > I have no idea what goes wrong.
>
> It is strange because in our application version that uses Wicket 7.x I
> see no WS requests in DevTools console as well, but the code is
> correctly executed and everything works.
> Yes the WebSocket connection seems to be established anyway in both our
> versions so with both Wicket 7.x and 8.x, but for some reason the
> "appendJavaScript()" method does not work on the
> "WebSocketRequestHandler" object with Wicket 8.x.
>
> Is there anything else we can try to make it work?
>

Put a breakpoint at
https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-core/src/main/java/org/apache/wicket/page/XmlPartialPageUpdate.java#L141
and see whether it is called.
And another one at
https://github.com/apache/wicket/blob/3704144b73521c6b10de5fa7864773230762e86c/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L86
to see whether the XML response is being written back to the browser in the
WebSocketConnection.


>
> Thanks
>
> >
> >
> >>> What is the type of resourceCreateEvent.getTarget() ?
> >>> Is it WebSocketRequestHandler or AjaxRequestHandler ?
> >> "resourceCreateEvent.getTarget()"type is "AjaxRequestHandler".
> >>
> >>>> [1]
> >>>>
> >>>>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
> >>>>
> >>>> On 21/02/19 10:01, Martin Grigorov wrote:
> >>>>> Hi,
> >>>>>
> >>>>> Check the browser's Dev Tools' console for any JavaScript errors.
> >>>>> If there are no errors then check in the DevTools Network tab whether
> >> the
> >>>>> WebSocket response frame contains the JS code in its body. It must be
> >>>>> inside <execution> XML element. If it is not there at all then it
> must
> >> be
> >>>>> something on the server side.
> >>>>>
> >>>>> On Thu, Feb 21, 2019 at 10:54 AM Matteo Alessandroni <
> >>>> skylark17@apache.org>
> >>>>> wrote:
> >>>>>
> >>>>>> Hi,
> >>>>>>
> >>>>>> we have a logic where a websocket message is sent from an
> "onEvent()"
> >>>>>> method [1] and catched in a WebSocketBehavior class [2].
> >>>>>> Then, a call to a js method "addEndpoint()"[3] must be executed.
> >>>>>> Our problem is that the js code "addEndpoint(...)" inside
> >>>>>> "handler.appendJavaScript(...)" [4] is not executed, so the code
> >>>>>> correctly reaches that switch case but it's like the
> >>>>>> "appendJavaScript(...)" is not working.
> >>>>>>
> >>>>>> On our application v2.0.x that code works and it uses Wicket 7.x,
> >> while
> >>>>>> the newer v2.1.x  uses Wicket 8.x and it does not work.
> >>>>>>
> >>>>>> Could you please give us an hint of this? Is there anything we are
> >>>>>> missing to make it work for Wicket 8.x?
> >>>>>>
> >>>>>> Thank you!
> >>>>>>
> >>>>>>
> >>>>>> [1]
> >>>>>>
> >>>>>>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
> >>>>>> [2]
> >>>>>>
> >>>>>>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L153-L157
> >>>>>> [3]
> >>>>>>
> >>>>>>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/resources/META-INF/resources/js/topology.js#L269-L280
> >>>>>> [4]
> >>>>>>
> >>>>>>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L154
> >>>>>> --
> >>>>>>
> >>>>>> Dott. Matteo Alessandroni
> >>>>>>
> >>>>>> Software Engineer @ Tirasa S.r.l.
> >>>>>>
> >>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>>>
> >>>>>> http://www.tirasa.net
> >>>>>>
> >>>>>> Apache Syncope PMC Member
> >>>>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>>>
> >>>>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>>>
> >>>> --
> >>>>
> >>>> Dott. Matteo Alessandroni
> >>>>
> >>>> Software Engineer @ Tirasa S.r.l.
> >>>>
> >>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>
> >>>> http://www.tirasa.net
> >>>>
> >>>> Apache Syncope PMC Member
> >>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>
> >>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>
> >> --
> >>
> >> Dott. Matteo Alessandroni
> >>
> >> Software Engineer @ Tirasa S.r.l.
> >>
> >> Viale Vittoria Colonna, 97 - 65127 Pescara
> >> Tel +39 0859116307 / FAX +39 0859111173
> >>
> >> http://www.tirasa.net
> >>
> >> Apache Syncope PMC Member
> >> http://people.apache.org/phonebook.html?uid=skylark17
> >> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>
> >> Tirasa S.r.l. <http://www.tirasa.net>
> >>
>
> --
>
> Dott. Matteo Alessandroni
>
> Software Engineer @ Tirasa S.r.l.
>
> Viale Vittoria Colonna, 97 - 65127 Pescara
> Tel +39 0859116307 / FAX +39 0859111173
>
> http://www.tirasa.net
>
> Apache Syncope PMC Member
> http://people.apache.org/phonebook.html?uid=skylark17
> <http://people.apache.org/phonebook.html?uid=skylark17>
>
> Tirasa S.r.l. <http://www.tirasa.net>
>

Re: WebSocketRequestHandler object not executing javascript code

Posted by Matteo Alessandroni <sk...@apache.org>.
On 21/02/19 12:14, Martin Grigorov wrote:
> On Thu, Feb 21, 2019 at 12:11 PM Matteo Alessandroni <
> matteo.alessandroni@tirasa.net> wrote:
>
>> Hi,
>>
>> On 21/02/19 11:05, Martin Grigorov wrote:
>>> When the WebSocket connection is established (maybe when the page is
>>> loaded) you should see an entry in the Network tab.
>>> If you select this entry then on the right-side you should see any WS
>>> messages to/from the server.
>> Yes I know how about WS debugging, but I do not see any WS request (with
>> WS devtool filter and without it).
>>
> Maybe this is the problem.
> If there is no WebSocket response at all then there is no way the JS code
> to be executed.
>
> But since your WebSocketBehavior callback method is executed then there
> must be an established WebSocket connection.
> I have no idea what goes wrong.

It is strange because in our application version that uses Wicket 7.x I 
see no WS requests in DevTools console as well, but the code is 
correctly executed and everything works.
Yes the WebSocket connection seems to be established anyway in both our 
versions so with both Wicket 7.x and 8.x, but for some reason the 
"appendJavaScript()" method does not work on the 
"WebSocketRequestHandler" object with Wicket 8.x.

Is there anything else we can try to make it work?

Thanks

>
>
>>> What is the type of resourceCreateEvent.getTarget() ?
>>> Is it WebSocketRequestHandler or AjaxRequestHandler ?
>> "resourceCreateEvent.getTarget()"type is "AjaxRequestHandler".
>>
>>>> [1]
>>>>
>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
>>>>
>>>> On 21/02/19 10:01, Martin Grigorov wrote:
>>>>> Hi,
>>>>>
>>>>> Check the browser's Dev Tools' console for any JavaScript errors.
>>>>> If there are no errors then check in the DevTools Network tab whether
>> the
>>>>> WebSocket response frame contains the JS code in its body. It must be
>>>>> inside <execution> XML element. If it is not there at all then it must
>> be
>>>>> something on the server side.
>>>>>
>>>>> On Thu, Feb 21, 2019 at 10:54 AM Matteo Alessandroni <
>>>> skylark17@apache.org>
>>>>> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> we have a logic where a websocket message is sent from an "onEvent()"
>>>>>> method [1] and catched in a WebSocketBehavior class [2].
>>>>>> Then, a call to a js method "addEndpoint()"[3] must be executed.
>>>>>> Our problem is that the js code "addEndpoint(...)" inside
>>>>>> "handler.appendJavaScript(...)" [4] is not executed, so the code
>>>>>> correctly reaches that switch case but it's like the
>>>>>> "appendJavaScript(...)" is not working.
>>>>>>
>>>>>> On our application v2.0.x that code works and it uses Wicket 7.x,
>> while
>>>>>> the newer v2.1.x  uses Wicket 8.x and it does not work.
>>>>>>
>>>>>> Could you please give us an hint of this? Is there anything we are
>>>>>> missing to make it work for Wicket 8.x?
>>>>>>
>>>>>> Thank you!
>>>>>>
>>>>>>
>>>>>> [1]
>>>>>>
>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
>>>>>> [2]
>>>>>>
>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L153-L157
>>>>>> [3]
>>>>>>
>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/resources/META-INF/resources/js/topology.js#L269-L280
>>>>>> [4]
>>>>>>
>>>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L154
>>>>>> --
>>>>>>
>>>>>> Dott. Matteo Alessandroni
>>>>>>
>>>>>> Software Engineer @ Tirasa S.r.l.
>>>>>>
>>>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>>>
>>>>>> http://www.tirasa.net
>>>>>>
>>>>>> Apache Syncope PMC Member
>>>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>>>
>>>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>>>
>>>> --
>>>>
>>>> Dott. Matteo Alessandroni
>>>>
>>>> Software Engineer @ Tirasa S.r.l.
>>>>
>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>
>>>> http://www.tirasa.net
>>>>
>>>> Apache Syncope PMC Member
>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>
>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>
>> --
>>
>> Dott. Matteo Alessandroni
>>
>> Software Engineer @ Tirasa S.r.l.
>>
>> Viale Vittoria Colonna, 97 - 65127 Pescara
>> Tel +39 0859116307 / FAX +39 0859111173
>>
>> http://www.tirasa.net
>>
>> Apache Syncope PMC Member
>> http://people.apache.org/phonebook.html?uid=skylark17
>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>
>> Tirasa S.r.l. <http://www.tirasa.net>
>>

-- 

Dott. Matteo Alessandroni

Software Engineer @ Tirasa S.r.l.

Viale Vittoria Colonna, 97 - 65127 Pescara
Tel +39 0859116307 / FAX +39 0859111173

http://www.tirasa.net

Apache Syncope PMC Member
http://people.apache.org/phonebook.html?uid=skylark17 
<http://people.apache.org/phonebook.html?uid=skylark17>

Tirasa S.r.l. <http://www.tirasa.net>

Re: WebSocketRequestHandler object not executing javascript code

Posted by Martin Grigorov <mg...@apache.org>.
On Thu, Feb 21, 2019 at 12:11 PM Matteo Alessandroni <
matteo.alessandroni@tirasa.net> wrote:

> Hi,
>
> On 21/02/19 11:05, Martin Grigorov wrote:
> > When the WebSocket connection is established (maybe when the page is
> > loaded) you should see an entry in the Network tab.
> > If you select this entry then on the right-side you should see any WS
> > messages to/from the server.
>
> Yes I know how about WS debugging, but I do not see any WS request (with
> WS devtool filter and without it).
>

Maybe this is the problem.
If there is no WebSocket response at all then there is no way the JS code
to be executed.

But since your WebSocketBehavior callback method is executed then there
must be an established WebSocket connection.
I have no idea what goes wrong.


>
> > What is the type of resourceCreateEvent.getTarget() ?
> > Is it WebSocketRequestHandler or AjaxRequestHandler ?
>
> "resourceCreateEvent.getTarget()"type is "AjaxRequestHandler".
>
> >> [1]
> >>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
> >>
> >>
> >> On 21/02/19 10:01, Martin Grigorov wrote:
> >>> Hi,
> >>>
> >>> Check the browser's Dev Tools' console for any JavaScript errors.
> >>> If there are no errors then check in the DevTools Network tab whether
> the
> >>> WebSocket response frame contains the JS code in its body. It must be
> >>> inside <execution> XML element. If it is not there at all then it must
> be
> >>> something on the server side.
> >>>
> >>> On Thu, Feb 21, 2019 at 10:54 AM Matteo Alessandroni <
> >> skylark17@apache.org>
> >>> wrote:
> >>>
> >>>> Hi,
> >>>>
> >>>> we have a logic where a websocket message is sent from an "onEvent()"
> >>>> method [1] and catched in a WebSocketBehavior class [2].
> >>>> Then, a call to a js method "addEndpoint()"[3] must be executed.
> >>>> Our problem is that the js code "addEndpoint(...)" inside
> >>>> "handler.appendJavaScript(...)" [4] is not executed, so the code
> >>>> correctly reaches that switch case but it's like the
> >>>> "appendJavaScript(...)" is not working.
> >>>>
> >>>> On our application v2.0.x that code works and it uses Wicket 7.x,
> while
> >>>> the newer v2.1.x  uses Wicket 8.x and it does not work.
> >>>>
> >>>> Could you please give us an hint of this? Is there anything we are
> >>>> missing to make it work for Wicket 8.x?
> >>>>
> >>>> Thank you!
> >>>>
> >>>>
> >>>> [1]
> >>>>
> >>>>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
> >>>> [2]
> >>>>
> >>>>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L153-L157
> >>>> [3]
> >>>>
> >>>>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/resources/META-INF/resources/js/topology.js#L269-L280
> >>>> [4]
> >>>>
> >>>>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L154
> >>>> --
> >>>>
> >>>> Dott. Matteo Alessandroni
> >>>>
> >>>> Software Engineer @ Tirasa S.r.l.
> >>>>
> >>>> Viale Vittoria Colonna, 97 - 65127 Pescara
> >>>> Tel +39 0859116307 / FAX +39 0859111173
> >>>>
> >>>> http://www.tirasa.net
> >>>>
> >>>> Apache Syncope PMC Member
> >>>> http://people.apache.org/phonebook.html?uid=skylark17
> >>>> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>>>
> >>>> Tirasa S.r.l. <http://www.tirasa.net>
> >>>>
> >> --
> >>
> >> Dott. Matteo Alessandroni
> >>
> >> Software Engineer @ Tirasa S.r.l.
> >>
> >> Viale Vittoria Colonna, 97 - 65127 Pescara
> >> Tel +39 0859116307 / FAX +39 0859111173
> >>
> >> http://www.tirasa.net
> >>
> >> Apache Syncope PMC Member
> >> http://people.apache.org/phonebook.html?uid=skylark17
> >> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>
> >> Tirasa S.r.l. <http://www.tirasa.net>
> >>
>
> --
>
> Dott. Matteo Alessandroni
>
> Software Engineer @ Tirasa S.r.l.
>
> Viale Vittoria Colonna, 97 - 65127 Pescara
> Tel +39 0859116307 / FAX +39 0859111173
>
> http://www.tirasa.net
>
> Apache Syncope PMC Member
> http://people.apache.org/phonebook.html?uid=skylark17
> <http://people.apache.org/phonebook.html?uid=skylark17>
>
> Tirasa S.r.l. <http://www.tirasa.net>
>

Re: WebSocketRequestHandler object not executing javascript code

Posted by Matteo Alessandroni <ma...@tirasa.net>.
Hi,

On 21/02/19 11:05, Martin Grigorov wrote:
> When the WebSocket connection is established (maybe when the page is
> loaded) you should see an entry in the Network tab.
> If you select this entry then on the right-side you should see any WS
> messages to/from the server.

Yes I know how about WS debugging, but I do not see any WS request (with 
WS devtool filter and without it).

> What is the type of resourceCreateEvent.getTarget() ?
> Is it WebSocketRequestHandler or AjaxRequestHandler ?

"resourceCreateEvent.getTarget()"type is "AjaxRequestHandler".

>> [1]
>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
>>
>>
>> On 21/02/19 10:01, Martin Grigorov wrote:
>>> Hi,
>>>
>>> Check the browser's Dev Tools' console for any JavaScript errors.
>>> If there are no errors then check in the DevTools Network tab whether the
>>> WebSocket response frame contains the JS code in its body. It must be
>>> inside <execution> XML element. If it is not there at all then it must be
>>> something on the server side.
>>>
>>> On Thu, Feb 21, 2019 at 10:54 AM Matteo Alessandroni <
>> skylark17@apache.org>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> we have a logic where a websocket message is sent from an "onEvent()"
>>>> method [1] and catched in a WebSocketBehavior class [2].
>>>> Then, a call to a js method "addEndpoint()"[3] must be executed.
>>>> Our problem is that the js code "addEndpoint(...)" inside
>>>> "handler.appendJavaScript(...)" [4] is not executed, so the code
>>>> correctly reaches that switch case but it's like the
>>>> "appendJavaScript(...)" is not working.
>>>>
>>>> On our application v2.0.x that code works and it uses Wicket 7.x, while
>>>> the newer v2.1.x  uses Wicket 8.x and it does not work.
>>>>
>>>> Could you please give us an hint of this? Is there anything we are
>>>> missing to make it work for Wicket 8.x?
>>>>
>>>> Thank you!
>>>>
>>>>
>>>> [1]
>>>>
>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
>>>> [2]
>>>>
>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L153-L157
>>>> [3]
>>>>
>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/resources/META-INF/resources/js/topology.js#L269-L280
>>>> [4]
>>>>
>>>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L154
>>>> --
>>>>
>>>> Dott. Matteo Alessandroni
>>>>
>>>> Software Engineer @ Tirasa S.r.l.
>>>>
>>>> Viale Vittoria Colonna, 97 - 65127 Pescara
>>>> Tel +39 0859116307 / FAX +39 0859111173
>>>>
>>>> http://www.tirasa.net
>>>>
>>>> Apache Syncope PMC Member
>>>> http://people.apache.org/phonebook.html?uid=skylark17
>>>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>>>
>>>> Tirasa S.r.l. <http://www.tirasa.net>
>>>>
>> --
>>
>> Dott. Matteo Alessandroni
>>
>> Software Engineer @ Tirasa S.r.l.
>>
>> Viale Vittoria Colonna, 97 - 65127 Pescara
>> Tel +39 0859116307 / FAX +39 0859111173
>>
>> http://www.tirasa.net
>>
>> Apache Syncope PMC Member
>> http://people.apache.org/phonebook.html?uid=skylark17
>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>
>> Tirasa S.r.l. <http://www.tirasa.net>
>>

-- 

Dott. Matteo Alessandroni

Software Engineer @ Tirasa S.r.l.

Viale Vittoria Colonna, 97 - 65127 Pescara
Tel +39 0859116307 / FAX +39 0859111173

http://www.tirasa.net

Apache Syncope PMC Member
http://people.apache.org/phonebook.html?uid=skylark17 
<http://people.apache.org/phonebook.html?uid=skylark17>

Tirasa S.r.l. <http://www.tirasa.net>

Re: WebSocketRequestHandler object not executing javascript code

Posted by Martin Grigorov <mg...@apache.org>.
On Thu, Feb 21, 2019 at 11:40 AM Matteo Alessandroni <sk...@apache.org>
wrote:

> Hi,
>
> thanks for the answer!
> There are no js errors and browser devtool does not show any WS request
> so I'm not sure it's passing the correct body.
>

When the WebSocket connection is established (maybe when the page is
loaded) you should see an entry in the Network tab.
If you select this entry then on the right-side you should see any WS
messages to/from the server.


> Anyway, if I add:
>
> resourceCreateEvent.getTarget().appendJavaScript(String.format("addEndpoint('%s',
>
> '%s', '%s');",
>                      resourceCreateEvent.getParent(),
>                      resourceCreateEvent.getKey(),
>                      resourceCreateEvent.getKind()));
>
> directly here [1], instead of calling "window.Wicket.WebSocket.send(..."
> it works and the "addEndpoint(...)" method is called.
> The main difference seems to be that the "appendJavaScript()" is called
> on "resourceCreateEvent.getTarget()" instead of on a WebSocketBehavior
> object.
>

What is the type of resourceCreateEvent.getTarget() ?
Is it WebSocketRequestHandler or AjaxRequestHandler ?


>
> [1]
>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
>
>
> On 21/02/19 10:01, Martin Grigorov wrote:
> > Hi,
> >
> > Check the browser's Dev Tools' console for any JavaScript errors.
> > If there are no errors then check in the DevTools Network tab whether the
> > WebSocket response frame contains the JS code in its body. It must be
> > inside <execution> XML element. If it is not there at all then it must be
> > something on the server side.
> >
> > On Thu, Feb 21, 2019 at 10:54 AM Matteo Alessandroni <
> skylark17@apache.org>
> > wrote:
> >
> >> Hi,
> >>
> >> we have a logic where a websocket message is sent from an "onEvent()"
> >> method [1] and catched in a WebSocketBehavior class [2].
> >> Then, a call to a js method "addEndpoint()"[3] must be executed.
> >> Our problem is that the js code "addEndpoint(...)" inside
> >> "handler.appendJavaScript(...)" [4] is not executed, so the code
> >> correctly reaches that switch case but it's like the
> >> "appendJavaScript(...)" is not working.
> >>
> >> On our application v2.0.x that code works and it uses Wicket 7.x, while
> >> the newer v2.1.x  uses Wicket 8.x and it does not work.
> >>
> >> Could you please give us an hint of this? Is there anything we are
> >> missing to make it work for Wicket 8.x?
> >>
> >> Thank you!
> >>
> >>
> >> [1]
> >>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
> >> [2]
> >>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L153-L157
> >> [3]
> >>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/resources/META-INF/resources/js/topology.js#L269-L280
> >> [4]
> >>
> >>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L154
> >>
> >> --
> >>
> >> Dott. Matteo Alessandroni
> >>
> >> Software Engineer @ Tirasa S.r.l.
> >>
> >> Viale Vittoria Colonna, 97 - 65127 Pescara
> >> Tel +39 0859116307 / FAX +39 0859111173
> >>
> >> http://www.tirasa.net
> >>
> >> Apache Syncope PMC Member
> >> http://people.apache.org/phonebook.html?uid=skylark17
> >> <http://people.apache.org/phonebook.html?uid=skylark17>
> >>
> >> Tirasa S.r.l. <http://www.tirasa.net>
> >>
>
> --
>
> Dott. Matteo Alessandroni
>
> Software Engineer @ Tirasa S.r.l.
>
> Viale Vittoria Colonna, 97 - 65127 Pescara
> Tel +39 0859116307 / FAX +39 0859111173
>
> http://www.tirasa.net
>
> Apache Syncope PMC Member
> http://people.apache.org/phonebook.html?uid=skylark17
> <http://people.apache.org/phonebook.html?uid=skylark17>
>
> Tirasa S.r.l. <http://www.tirasa.net>
>

Re: WebSocketRequestHandler object not executing javascript code

Posted by Matteo Alessandroni <sk...@apache.org>.
Hi,

thanks for the answer!
There are no js errors and browser devtool does not show any WS request 
so I'm not sure it's passing the correct body.
Anyway, if I add:

resourceCreateEvent.getTarget().appendJavaScript(String.format("addEndpoint('%s', 
'%s', '%s');",
                     resourceCreateEvent.getParent(),
                     resourceCreateEvent.getKey(),
                     resourceCreateEvent.getKind()));

directly here [1], instead of calling "window.Wicket.WebSocket.send(..." 
it works and the "addEndpoint(...)" method is called.
The main difference seems to be that the "appendJavaScript()" is called 
on "resourceCreateEvent.getTarget()" instead of on a WebSocketBehavior 
object.

[1] 
https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609


On 21/02/19 10:01, Martin Grigorov wrote:
> Hi,
>
> Check the browser's Dev Tools' console for any JavaScript errors.
> If there are no errors then check in the DevTools Network tab whether the
> WebSocket response frame contains the JS code in its body. It must be
> inside <execution> XML element. If it is not there at all then it must be
> something on the server side.
>
> On Thu, Feb 21, 2019 at 10:54 AM Matteo Alessandroni <sk...@apache.org>
> wrote:
>
>> Hi,
>>
>> we have a logic where a websocket message is sent from an "onEvent()"
>> method [1] and catched in a WebSocketBehavior class [2].
>> Then, a call to a js method "addEndpoint()"[3] must be executed.
>> Our problem is that the js code "addEndpoint(...)" inside
>> "handler.appendJavaScript(...)" [4] is not executed, so the code
>> correctly reaches that switch case but it's like the
>> "appendJavaScript(...)" is not working.
>>
>> On our application v2.0.x that code works and it uses Wicket 7.x, while
>> the newer v2.1.x  uses Wicket 8.x and it does not work.
>>
>> Could you please give us an hint of this? Is there anything we are
>> missing to make it work for Wicket 8.x?
>>
>> Thank you!
>>
>>
>> [1]
>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
>> [2]
>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L153-L157
>> [3]
>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/resources/META-INF/resources/js/topology.js#L269-L280
>> [4]
>>
>> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L154
>>
>> --
>>
>> Dott. Matteo Alessandroni
>>
>> Software Engineer @ Tirasa S.r.l.
>>
>> Viale Vittoria Colonna, 97 - 65127 Pescara
>> Tel +39 0859116307 / FAX +39 0859111173
>>
>> http://www.tirasa.net
>>
>> Apache Syncope PMC Member
>> http://people.apache.org/phonebook.html?uid=skylark17
>> <http://people.apache.org/phonebook.html?uid=skylark17>
>>
>> Tirasa S.r.l. <http://www.tirasa.net>
>>

-- 

Dott. Matteo Alessandroni

Software Engineer @ Tirasa S.r.l.

Viale Vittoria Colonna, 97 - 65127 Pescara
Tel +39 0859116307 / FAX +39 0859111173

http://www.tirasa.net

Apache Syncope PMC Member
http://people.apache.org/phonebook.html?uid=skylark17 
<http://people.apache.org/phonebook.html?uid=skylark17>

Tirasa S.r.l. <http://www.tirasa.net>

Re: WebSocketRequestHandler object not executing javascript code

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

Check the browser's Dev Tools' console for any JavaScript errors.
If there are no errors then check in the DevTools Network tab whether the
WebSocket response frame contains the JS code in its body. It must be
inside <execution> XML element. If it is not there at all then it must be
something on the server side.

On Thu, Feb 21, 2019 at 10:54 AM Matteo Alessandroni <sk...@apache.org>
wrote:

> Hi,
>
> we have a logic where a websocket message is sent from an "onEvent()"
> method [1] and catched in a WebSocketBehavior class [2].
> Then, a call to a js method "addEndpoint()"[3] must be executed.
> Our problem is that the js code "addEndpoint(...)" inside
> "handler.appendJavaScript(...)" [4] is not executed, so the code
> correctly reaches that switch case but it's like the
> "appendJavaScript(...)" is not working.
>
> On our application v2.0.x that code works and it uses Wicket 7.x, while
> the newer v2.1.x  uses Wicket 8.x and it does not work.
>
> Could you please give us an hint of this? Is there anything we are
> missing to make it work for Wicket 8.x?
>
> Thank you!
>
>
> [1]
>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java#L602-L609
> [2]
>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L153-L157
> [3]
>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/resources/META-INF/resources/js/topology.js#L269-L280
> [4]
>
> https://github.com/apache/syncope/blob/2_1_X/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.java#L154
>
> --
>
> Dott. Matteo Alessandroni
>
> Software Engineer @ Tirasa S.r.l.
>
> Viale Vittoria Colonna, 97 - 65127 Pescara
> Tel +39 0859116307 / FAX +39 0859111173
>
> http://www.tirasa.net
>
> Apache Syncope PMC Member
> http://people.apache.org/phonebook.html?uid=skylark17
> <http://people.apache.org/phonebook.html?uid=skylark17>
>
> Tirasa S.r.l. <http://www.tirasa.net>
>