0

WebAppInit, WebAppCleanup when are the mehtodes called?

asked 2008-09-24 08:19:45 +0800

Heintz gravatar image Heintz
24

Hello,
I implemented the WebAppInit and WebAppCleanup interface.

I expected the WebAppInit to be called when the web application is started (I use Tomcat).

In reality init(WebApp wapp) is not called when the web application is started, but when any zul-page is called the first on that application. It is only a small difference for sure, but if the initialization code e.g. provide services for another application outside, there might be nobody calling a zul-page before the service is used. Is that behavior not a bug? What can I do come around?

I expect the cleanup(WebApp wapp)to be called when the web application is stopped e.g. when I stop Tomcat but it is not. When is cleanup(WebApp wapp) called? What can I do if want to do something before tomcat stops?

Thank you in advance

-peter

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2008-10-02 08:05:40 +0800

robertlee gravatar image robertlee
561

It does work for me,
I believe you have missed your listener declaration under zk.xml

Please refer to the following:

http://www.zkoss.org/doc/devref/ch08s01s02.html

link publish delete flag offensive edit

answered 2008-10-06 10:14:35 +0800

Heintz gravatar image Heintz
24

Hello Robert,
Yes you are right. cCleanup works.
I just missed to configure my logger for that. However the problem, that the init method is called when a first zul page is loaded and not when the application is started remains.

-Peter

link publish delete flag offensive edit

answered 2008-10-06 15:10:28 +0800

dastultz gravatar image dastultz
797 9

It works for me, too. Your web.xml should have a section something like this:

<servlet>
         <description>ZK loader for evaluating ZK pages</description>
         <servlet-name>zkLoader</servlet-name>
         <servlet-class>org.zkoss.zk.ui.http.DHtmlLayoutServlet</servlet-class>
         <!-- Must. Specifies URI of the update engine (DHtmlUpdateServlet). -->
         <init-param>
            <param-name>update-uri</param-name>
            <param-value>/zkau</param-value>
         </init-param>
         <load-on-startup>1</load-on-startup><!-- MUST -->
     </servlet>

Note that load-on-startup is 1.

/Daryl

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2008-09-24 08:19:45 +0800

Seen: 444 times

Last updated: Oct 06 '08

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More