package org.springframework.web.servlet; @SuppressWarnings("serial") publicclassDispatcherServletextendsFrameworkServlet { publicstaticfinalStringMULTIPART_RESOLVER_BEAN_NAME="multipartResolver"; publicstaticfinalStringLOCALE_RESOLVER_BEAN_NAME="localeResolver"; publicstaticfinalStringTHEME_RESOLVER_BEAN_NAME="themeResolver"; publicstaticfinalStringHANDLER_MAPPING_BEAN_NAME="handlerMapping"; publicstaticfinalStringHANDLER_ADAPTER_BEAN_NAME="handlerAdapter"; publicstaticfinalStringHANDLER_EXCEPTION_RESOLVER_BEAN_NAME="handlerExceptionResolver"; publicstaticfinalStringREQUEST_TO_VIEW_NAME_TRANSLATOR_BEAN_NAME="viewNameTranslator"; publicstaticfinalStringVIEW_RESOLVER_BEAN_NAME="viewResolver"; publicstaticfinalStringFLASH_MAP_MANAGER_BEAN_NAME="flashMapManager"; publicstaticfinalStringWEB_APPLICATION_CONTEXT_ATTRIBUTE= DispatcherServlet.class.getName() + ".CONTEXT"; publicstaticfinalStringLOCALE_RESOLVER_ATTRIBUTE= DispatcherServlet.class.getName() + ".LOCALE_RESOLVER"; publicstaticfinalStringTHEME_RESOLVER_ATTRIBUTE= DispatcherServlet.class.getName() + ".THEME_RESOLVER"; publicstaticfinalStringTHEME_SOURCE_ATTRIBUTE= DispatcherServlet.class.getName() + ".THEME_SOURCE"; publicstaticfinalStringINPUT_FLASH_MAP_ATTRIBUTE= DispatcherServlet.class.getName() + ".INPUT_FLASH_MAP"; publicstaticfinalStringOUTPUT_FLASH_MAP_ATTRIBUTE= DispatcherServlet.class.getName() + ".OUTPUT_FLASH_MAP"; publicstaticfinalStringFLASH_MAP_MANAGER_ATTRIBUTE= DispatcherServlet.class.getName() + ".FLASH_MAP_MANAGER"; publicstaticfinalStringEXCEPTION_ATTRIBUTE= DispatcherServlet.class.getName() + ".EXCEPTION"; publicstaticfinalStringPAGE_NOT_FOUND_LOG_CATEGORY="org.springframework.web.servlet.PageNotFound"; privatestaticfinalStringDEFAULT_STRATEGIES_PATH="DispatcherServlet.properties"; protectedstaticfinalLogpageNotFoundLogger= LogFactory.getLog(PAGE_NOT_FOUND_LOG_CATEGORY); privatestaticfinal Properties defaultStrategies; static { try { ClassPathResourceresource=newClassPathResource(DEFAULT_STRATEGIES_PATH, DispatcherServlet.class); defaultStrategies = PropertiesLoaderUtils.loadProperties(resource); } catch (IOException ex) { thrownewIllegalStateException("Could not load 'DispatcherServlet.properties': " + ex.getMessage()); } } /** Detect all HandlerMappings or just expect "handlerMapping" bean? */ privatebooleandetectAllHandlerMappings=true; /** Detect all HandlerAdapters or just expect "handlerAdapter" bean? */ privatebooleandetectAllHandlerAdapters=true; /** Detect all HandlerExceptionResolvers or just expect "handlerExceptionResolver" bean? */ privatebooleandetectAllHandlerExceptionResolvers=true; /** Detect all ViewResolvers or just expect "viewResolver" bean? */ privatebooleandetectAllViewResolvers=true; /** Throw a NoHandlerFoundException if no Handler was found to process this request? **/ privatebooleanthrowExceptionIfNoHandlerFound=false; /** Perform cleanup of request attributes after include request? */ privatebooleancleanupAfterInclude=true; /** 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; private FlashMapManager flashMapManager; /** List of ViewResolvers used by this servlet */ private List<ViewResolver> viewResolvers; publicDispatcherServlet() { super(); } publicDispatcherServlet(WebApplicationContext webApplicationContext) { super(webApplicationContext); } @Override protectedvoidonRefresh(ApplicationContext context) { initStrategies(context); } protectedvoidinitStrategies(ApplicationContext context) { initMultipartResolver(context); initLocaleResolver(context); initThemeResolver(context); initHandlerMappings(context); initHandlerAdapters(context); initHandlerExceptionResolvers(context); initRequestToViewNameTranslator(context); initViewResolvers(context); initFlashMapManager(context); } }