There is another interface available which provides the additional method applicationRefreshed. This event is always raised if the method refresh() of the Application-Object is fired.
Instead of implement the interface described in the previous posting, you have to use the interface named com.ibm.xsp.application.events.ApplicationListener2.
package ch.hasselba.jsf.debug; import com.ibm.xsp.application.ApplicationEx; import com.ibm.xsp.application.events.ApplicationListener2; public class MyApplicationListener implements ApplicationListener2 { public void applicationCreated(ApplicationEx arg0) { System.out.println("applicationCreated()"); System.out.println("ID: " + arg0.getApplicationId()); } public void applicationDestroyed(ApplicationEx arg0) { System.out.println("applicationDestroyed()"); System.out.println("ID: " + arg0.getApplicationId()); } public void applicationRefreshed(ApplicationEx arg0) { System.out.println("applicationRefreshed()"); System.out.println("ID: " + arg0.getApplicationId()); } }
You can fire the refresh of the application manually. Here is a simple example how to do this:
<?xml version="1.0" encoding="UTF-8"?> <xp:view xmlns:xp="http://www.ibm.com/xsp/core"> <xp:button value="Label" id="button1"> <xp:eventHandler event="onclick" submit="true" refreshMode="complete"> <xp:this.action> <![CDATA[#{javascript: facesContext.getApplication().refresh() }]]> </xp:this.action> </xp:eventHandler> </xp:button> </xp:view>
By clicking the button, the refresh is fired:
I can’t get it to work. I put everything in place and cant see no messages on console. I’m testing on Domino 8.5.3. Is the META-INF/… file all the requitred configuration to ge it to work? Dont you have any simple db as working demo?
Just got it to work, I realized, thet txt file must be named com.ibm.xsp.core.events.ApplicationListener … but the ApplicationListener is in package com.ibm.xsp.application.events.ApplicationListener (see the .core. vs. .application.)
Hi,
I can’t get this application listener in Domino 8.5.2.
I need it for implementing some java libraries/frameworks and destroying that resources on app destroy.
Do you know „trick“ for 8.5.2?
Thanks
Vedran
One more thing, I tried ApplicationListener(1) method and it doesn’t work.
As far as I know the ApplicationListener was introduced in 8.5.3.