【五】geoserver源码&GeoServerSecurityManager回调函数onApplicationEvent接收的那些事件

 

 

我们知道GeoServerSecurityManager类通过实现ApplicationListener接口,实现onApplicationEvent(ApplicationEvent event)方法。但是该方法中第一个判断是GeoServer平台自己创建的。

    @Override
    public void onApplicationEvent(ApplicationEvent event) {
        if (event instanceof ContextLoadedEvent) {
            reload();
        }
        if (event instanceof ContextClosedEvent) {
            try {
                destroy();
            } catch (Exception e) {
                LOGGER.log(Level.WARNING, "Error destroying security manager", e);
            }
        }
    }

ContextLoadedEvent源码非常简单,这里索性贴出来看一下。通过注释已经一目了然。意为application上下文成功后发布的。

/**
 * Custom application context event that is fired after the application context is successfully
 * loaded.
 *
 * @author Justin Deoliveira, OpenGeo
 */
public class ContextLoadedEvent extends ApplicationContextEvent {

    public ContextLoadedEvent(ApplicationContext sour
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章