-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi!
I've a web application where I execute an external program through Javascript because is the only way to call it. When I receive the data from the external program through AJAX, my Java VM doesn't have access to Filedownload, Clients or Executions, all of this are null, but if I call them before the external program, they works, why?
To clarify what's happening, which part of your application is making the request to the external application? Is it coming from the client-side (the web browser), or the server-side (the java server-side app)? I know you already mentioned Ajax and JS, but I don't know if that's what the external app is using, or what the ZK app is using to call it.
Does your client (the browser) send that Ajax request, and receives the response? Or does the server (the server-side Java class, like your VM) fetch the data from a Java ajax call?
If you are running the request from server-side, then the answer is easy. When you receive the response from the other application, you are no longer in a ZK working thread. (there is no execution, because there is no request waiting to be fulfilled)
You need server-push to be able to start a response from server-side. https://www.zkoss.org/wiki/ZKDeveloper%27sReference/Server_Push
Server-push allows the server to start a working thread, even if the user hasn't performed any action causing a request to be available.
If your request is sent by the browser, then things might be more complicated. You should check in the browser's developer tools > network panel and see if you can find a /zkau request with content "rmDesktop"
If you find such a request immediately after receiving the response from the external app, then something in the response is causing the ZK client-side engine to cleanup. (usually this happen if beforeUnload event is triggered in the browser)
Thanks for your answer,
The request is called from the client side, through Javascript, i have a button in ZK that call a Java function in the VM and this Java function call a Javascript function that executes the external proccess. When the external proccess ends, I send an Ajax POST to JAVA with the data and receive it in the same VM and here's when the problems begin.
Asked: 2024-02-20 00:41:11 +0800
Seen: 10 times
Last updated: Feb 21