【五】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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章