Spring MVC启动——initStrategies


    protected void initStrategies(ApplicationContext context) {

        this.initMultipartResolver(context);
        this.initLocaleResolver(context);
        this.initThemeResolver(context);
        this.initHandlerMappings(context);
        this.initHandlerAdapters(context);
        this.initHandlerExceptionResolvers(context);
        this.initRequestToViewNameTranslator(context);
        this.initViewResolvers(context);
        this.initFlashMapManager(context);
    }

1. MultipartResolver: 

http://exceptioneye.iteye.com/blog/1314958
--> CommonsMultipartResolver 文件上传解析器
2. LocalResolver: 支持国际化,区域解析器。每DispatcherServlet只能注册一个区域解析器
http://blog.csdn.net/rj042/article/details/23354225
   --> AcceptHeaderLocaleResolver 它通过检验HTTP请求的accept-language头部来解析区域。由用户的web浏览器根据底层操作系统的区域设置进行设定。
   --> SessionLocaleResolver 它通过检验用户会话中预置的属性来解析区域。如果该会话属性
不存在,它会根据accept-language HTTP头部确定默认区域。
--> CookieLocaleResolver来解析区域。如果Cookie不存在,它会根据accept-language HTTP头部确定默认区域。 
--> FixedLocaleResolver 一直使用固定的Local, 不支持Local改变 。


修改用户的区域
除了显式调用LocaleResolver.setLocale()来修改用户的区域之外,还可以将LocaleChangeInterceptor拦截器应用到处理程序映射中,它会发现当前HTTP请求中出现的特殊参数。其中的参数名称可以通过拦截器的paramName属性进行自定义。如果这种参数出现在当前请求中,拦截器就会根据参数值来改变用户的区域。
3. ThemeSource 动态更换样式的支持(主题)
http://starscream.iteye.com/blog/1075855
--> FixedThemeResolver:固定格式的theme,不能在系统运行时动态更改theme.
--> SessionThemeResolver:theme name存放在session中key值为 org.springframework.web.servlet.theme.SessionThemeResolver.THEME 的session attribute中。可在运行中通过更改session中的相应的key值来动态调整theme的值。
--> CookieThemeResolver:theme name存放在cookie中key值为 org.springframework.web.servlet.theme.CookieThemeResolver.THEME 中。可在运行中通过更改cookie中的相应的key值来动态调整theme的值。
4. HandlerMapping
http://blog.csdn.net/sunxing007/article/details/4584748
http://blog.csdn.net/prince2270/article/details/5894456
-->BeanNameUrlHandlerMapping: 查找spring容器中和请求的url同名的bean.
-->BeanNameUrlHandlerMapping :通过对比url和bean的name找到对应的对象 
-->SimpleUrlHandlerMapping :也是直接配置url和对应bean,比BeanNameUrlHandlerMapping功能更多 
-->DefaultAnnotationHandlerMapping : 主要是针对注解配置@RequestMapping的,已过时 
-->RequestMappingHandlerMapping :取代了上面一个 
  --> 还有很多 ,请看源码
5. HandlerAdapter
--> SimpleControllerHandlerAdapter
--> SimpleServletHandlerAdapter
--> RequestMappingHandlerAdapter
--> HttpRequestHandlerAdapter
--> AnnotationMethodHandlerAdapter
6. HandlerExceptionResolver
7. RequestToViewNameTranslator  用于直接将请求转换为逻辑视图名。
http://sishuok.com/forum/blogPost/list/0/5514.html
http://haohaoxuexi.iteye.com/blog/1774603
--> DefaultRequestToViewNameTranslator
[
http://localhost:9080/web上下文/list -------> 逻辑视图名为list
  http://localhost:9080/web上下文/list.html -------> 逻辑视图名为list(默认删除扩展名)
  http://localhost:9080/web上下文/user/list.html -------> 逻辑视图名为user/list
]
8. ViewResolver 视图解析器:定义了如何通过view 名称来解析对应View实例的行为
http://blog.csdn.net/prince2270/article/details/5891085
http://www.iteye.com/problems/76107 多视图问题的解决
http://my.oschina.net/HeliosFly/blog/221392
9. FlashMapManager  
http://www.oschina.net/translate/spring-mvc-flash-attribute-example
--> SessionFlashMapManager


整体讲解
http://www.cnblogs.com/davidwang456/p/4090058.html

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值