myoldman 发表于 2013-1-29 23:39:21

Struts2 Core Developers Guide-DispatcherListener

1.主要功能
在Dispatcher对象init或者destroy的时候执行某些代码接口如下
public void dispatcherInitialized(Dispatcher du) {            // do something to Dispatcher after it is initialized eg.            du.setConfigurationManager(....);         }         public void dispatcherDestroyed(Dispatcher du) {            // do some cleanup after Dispatcher is destroyed.         }}
源代码上看只有Dispatcher.init()方法中和WebLogic相关的部分有调用到DispatcherListener的dispatcherInitialized方法,所有感觉该接口不是那么重要的样子。
    private void init_CheckWebLogicWorkaround(Container container) {      // test whether param-access workaround needs to be enabled      if (servletContext != null && servletContext.getServerInfo() != null                && servletContext.getServerInfo().indexOf("WebLogic") >= 0) {            LOG.info("WebLogic server detected. Enabling Struts parameter access work-around.");            paramsWorkaroundEnabled = true;      } else {            paramsWorkaroundEnabled = "true".equals(container.getInstance(String.class,                  StrutsConstants.STRUTS_DISPATCHER_PARAMETERSWORKAROUND));      }      synchronized(Dispatcher.class) {            if (dispatcherListeners.size() > 0) {                for (DispatcherListener l : dispatcherListeners) {                  l.dispatcherInitialized(this);                }            }      }}
页: [1]
查看完整版本: Struts2 Core Developers Guide-DispatcherListener