public class SecurityWebAppInit implements org.zkoss.zk.ui.util.WebAppInit {
private static String RESOLVER_CLASS = org.zkoss.spring.DelegatingVariableResolver.RESOLVER_CLASS;
private static String SECURITY_RESOLVER = "org.zkoss.spring.init.SecurityVariableResolver";
@SuppressWarnings("deprecation")
public void init(WebApp wapp) throws Exception {
final Configuration conf = wapp.getConfiguration();
final ConfigurableApplicationContext ctx = (ConfigurableApplicationContext)
WebApplicationContextUtils.getRequiredWebApplicationContext((ServletContext)wapp.getNativeContext());
//add listener for ZK + Security
if (ctx.containsBeanDefinition(ZkBeanIds.ZK_DESKTOP_REUSE_FILTER)) {
conf.addListener(ZkSecurityContextListener.class);
conf.addListener(ZkExceptionTranslationListener.class);
conf.addListener(ZkEventProcessListener.class);
}
String classes = Library.getProperty(RESOLVER_CLASS);
if (classes == null) {
Library.setProperty(RESOLVER_CLASS, SECURITY_RESOLVER);