# how to catch applet client exception

apam
24 1

Hi, I have problem with an applet, sometime users, due to continuos java and brower updates and securety restriction, fail to check security alert and the applet does not load.

When this happen I get an

SEVERE: [Desktop zmd:/authriv/menu.zul] client error: Method not found: findPrinter on log file and a zkoss popup error with "method not found: findPrinter" because the applet class isn't loaded due to some browser or java restriction

I call the applet method on server side in this way: applet.invoke("findPrinter", "HPxxx");

Is there a way to catch this exception in my code ? Is there a way to undestand if the applet class il loaded on server side ?

thank you giuseppe

delete retag edit

Sort by » oldest newest most voted

apam
24 1

Hi, thank you for you reply I tried to catch the exception server side in the way you show me but the excepion is catched by zk before ( I tried again just few minutes ago ) and never passed to my code

oke I'll look in to it. but can you give full stacktrace? and what version (for the correct class of zk

( 2014-01-14 07:35:04 +0800 )edit

You are sure that you have the method findPrinter and your path to your applet is correct? (this is not really a problem that could work sometimes and sometimes not)

( 2014-01-14 07:41:03 +0800 )edit

apam
24 1

The applet works fine if do not block it ( user can block applet if press wrong button in security popup ) When apple is blocked, applet class is not loaded and if I try to use a method, like "findPrinter", zk rise an axception. It's correct and I just want to catch this situation and inform user about this problem instead of view zk popup exception For this project I'm using zk 6.0.2 I tried to use zk.xml error page element (http://books.zkoss.org/wiki/ZK%20Configuration%20Reference/zk.xml/The%20error-page%20Element ) but without success

chillworld
5322 4 9
https://github.com/chillw...

Oke I searched a little further. In zk 7.0 (don't know older versions) we have this :

if (applet.isMayscript()){
applet.invoke("findPrinter", "HPxxx");
} else {
}


Can you try this?

apam
24 1

Sorry, I did a mistake while testing isMayscript(). It return always False even if the applet is correctly loaded giuseppe

oke, I'll search further. Sorry that I have to ask you to try things but that is that I can't test your code myself. (I delete mine post cause its wrong, maybe you can clean also a little

( 2014-01-14 14:41:27 +0800 )edit

apam
24 1

wow!! seems to work

I do not understand why but I'll study the documentation isMayscript works 6.0.2 too Thanks a lot

Giuseppe

apam
24 1

Sorry, I did a mistake while testing isMayscript function. It return always False even if the applet is corrctly loaded :(

giuseppe

chioannou
0

I dont think that anything in the zk's Applet class will help you to catch it. I have the same problem with an applet that i use for printing and i couldnt find a solution. One hard approach is to call a url with the session id from the applet and inform the server that the applet is loaded and unblock the findPrinter(). I will try if i can intercept ZK's messages first.

thak you.

( 2014-01-17 13:35:34 +0800 )edit
[hide preview]