ホームページ >Java >&#&チュートリアル >DispatcherServletクラスの説明
==================以下は、まだ修正が必要なクラス定義とクラス注釈の一部の翻訳です。 =================
/**
=================== =====以下は、このクラスのより重要な属性の一部です==========================
"serial" DispatcherServlet
============================以下はクラスのパラメータなしのコンストラクタです======= ===== ===============
}
================= 以下は initStrategies です。 (ApplicationContext コンテキスト) メソッド =================
主に、上記の重要な属性のいくつかを初期化します。
/** MultipartResolver used by this servlet */private MultipartResolver multipartResolver; /** LocaleResolver used by this servlet */private LocaleResolver localeResolver;/** ThemeResolver used by this servlet */private ThemeResolver themeResolver;/** List of HandlerMappings used by this servlet */private List<HandlerMapping> handlerMappings; //处理器映射列表/** List of HandlerAdapters used by this servlet */private List<HandlerAdapter> handlerAdapters; //处理器适配器列表/** List of HandlerExceptionResolvers used by this servlet */private List<HandlerExceptionResolver> handlerExceptionResolvers; //处理器异常解析器列表/** RequestToViewNameTranslator used by this servlet */private RequestToViewNameTranslator viewNameTranslator;/** FlashMapManager used by this servlet */private FlashMapManager flashMapManager;/** List of ViewResolvers used by this servlet */private List<ViewResolver> viewResolvers; //视图解析器列表
<span style="color: #008000">/**</span><span style="color: #008000"> * Create a new {</span><span style="color: #808080">@code</span><span style="color: #008000"> DispatcherServlet} that will create its own internal web * application context based on defaults and values provided through servlet * init-params. Typically used in Servlet 2.5 or earlier environments, where the only * option for servlet registration is through {</span><span style="color: #808080">@code</span><span style="color: #008000"> web.xml} which requires the use * of a no-arg constructor. * <p>Calling {</span><span style="color: #808080">@link</span><span style="color: #008000"> #setContextConfigLocation} (init-param 'contextConfigLocation') * will dictate which XML files will be loaded by the * {</span><span style="color: #808080">@linkplain</span><span style="color: #008000"> #DEFAULT_CONTEXT_CLASS default XmlWebApplicationContext} * <p>Calling {</span><span style="color: #808080">@link</span><span style="color: #008000"> #setContextClass} (init-param 'contextClass') overrides the * default {</span><span style="color: #808080">@code</span><span style="color: #008000"> XmlWebApplicationContext} and allows for specifying an alternative class, * such as {</span><span style="color: #808080">@code</span><span style="color: #008000"> AnnotationConfigWebApplicationContext}. * <p>Calling {</span><span style="color: #808080">@link</span><span style="color: #008000"> #setContextInitializerClasses} (init-param 'contextInitializerClasses') * indicates which {</span><span style="color: #808080">@code</span><span style="color: #008000"> ApplicationContextInitializer} classes should be used to * further configure the internal application context prior to refresh(). * </span><span style="color: #808080">@see</span><span style="color: #008000"> #DispatcherServlet(WebApplicationContext)<br> * </span><span style="color: #008000">*/</span><span style="color: #0000ff">public</span><span style="color: #000000"> DispatcherServlet() {</span><span style="color: #0000ff">super</span><span style="color: #000000">(); setDispatchOptionsRequest(</span><span style="color: #0000ff">true</span><span style="color: #000000">); }</span>rree
=============================================================================================================== == ============
//初始化这个DispatcherServlet使用到的策略对象。这个方法有可能会被子类覆盖。protected void initStrategies(ApplicationContext context) { initMultipartResolver(context); initLocaleResolver(context); initThemeResolver(context);
/* * * */ initHandlerMappings(context);
============================================= ====== ========================
initHandlerExceptionResolvers(context); initRequestToViewNameTranslator(context); initViewResolvers(context); initFlashMapManager(context); }
=============== ======= ========================================== ======= ==
doService(HttpServletRequest request, HttpServletResponse response) = WebAsyncUtils.getAsyncManager(request).hasConcurrentResult() ? " resumed" : """DispatcherServlet with name '" + getServletName() + "'" + resumed + " processing " + request.getMethod() + " request for [" + getRequestUri(request) + "]"<String, Object> attributesSnapshot = = HashMap<String, Object><?> attrNames == (.cleanupAfterInclude || attrName.startsWith("org.springframework.web.servlet"= (inputFlashMap != (! (attributesSnapshot !=
doDispatch(HttpServletRequest request, HttpServletResponse response) == multipartRequestParsed = WebAsyncManager asyncManager == = processedRequest == (processedRequest !=mappedHandler = (mappedHandler == || mappedHandler.getHandler() == HandlerAdapter ha =String method = isGet = "GET" (isGet || "HEAD" lastModified ="Last-Modified value for [" + getRequestUri(request) + "] is: " + ( ServletWebRequest(request, response).checkNotModified(lastModified) && (!mv ==dispatchException = NestedServletException("Handler dispatch failed" NestedServletException("Handler processing failed" (mappedHandler !=
======================== ============= ====================================
============ =================================== ============== ============
====================== ================ ================================= ===
============ ================================ ================= ============
以上がDispatcherServletクラスの説明の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。