Java 类org.springframework.web.servlet.view.DefaultRequestToViewNameTranslator 实例源码

项目:class-guard    文件:StandaloneMockMvcBuilder.java   
private void registerMvcSingletons(StubWebApplicationContext cxt) {

        StandaloneConfiguration configuration = new StandaloneConfiguration();

        RequestMappingHandlerMapping handlerMapping = configuration.requestMappingHandlerMapping();
        handlerMapping.setServletContext(cxt.getServletContext());
        handlerMapping.setApplicationContext(cxt);
        cxt.addBean("requestMappingHandlerMapping", handlerMapping);

        RequestMappingHandlerAdapter handlerAdapter = configuration.requestMappingHandlerAdapter();
        handlerAdapter.setServletContext(cxt.getServletContext());
        handlerAdapter.setApplicationContext(cxt);
        handlerAdapter.afterPropertiesSet();
        cxt.addBean("requestMappingHandlerAdapter", handlerAdapter);

        cxt.addBean("handlerExceptionResolver", configuration.handlerExceptionResolver());

        cxt.addBeans(initViewResolvers(cxt));
        cxt.addBean(DispatcherServlet.LOCALE_RESOLVER_BEAN_NAME, this.localeResolver);
        cxt.addBean(DispatcherServlet.THEME_RESOLVER_BEAN_NAME, new FixedThemeResolver());
        cxt.addBean(DispatcherServlet.REQUEST_TO_VIEW_NAME_TRANSLATOR_BEAN_NAME, new DefaultRequestToViewNameTranslator());

        this.flashMapManager = new SessionFlashMapManager();
        cxt.addBean(DispatcherServlet.FLASH_MAP_MANAGER_BEAN_NAME, this.flashMapManager);
    }
项目:spring4-understanding    文件:StandaloneMockMvcBuilder.java   
private void registerMvcSingletons(StubWebApplicationContext wac) {
    StandaloneConfiguration config = new StandaloneConfiguration();
    config.setApplicationContext(wac);

    wac.addBeans(this.controllerAdvice);

    StaticRequestMappingHandlerMapping hm = config.getHandlerMapping();
    hm.setServletContext(wac.getServletContext());
    hm.setApplicationContext(wac);
    hm.afterPropertiesSet();
    hm.registerHandlers(this.controllers);
    wac.addBean("requestMappingHandlerMapping", hm);

    RequestMappingHandlerAdapter handlerAdapter = config.requestMappingHandlerAdapter();
    handlerAdapter.setServletContext(wac.getServletContext());
    handlerAdapter.setApplicationContext(wac);
    handlerAdapter.afterPropertiesSet();
    wac.addBean("requestMappingHandlerAdapter", handlerAdapter);

    wac.addBean("handlerExceptionResolver", config.handlerExceptionResolver());

    wac.addBeans(initViewResolvers(wac));
    wac.addBean(DispatcherServlet.LOCALE_RESOLVER_BEAN_NAME, this.localeResolver);
    wac.addBean(DispatcherServlet.THEME_RESOLVER_BEAN_NAME, new FixedThemeResolver());
    wac.addBean(DispatcherServlet.REQUEST_TO_VIEW_NAME_TRANSLATOR_BEAN_NAME, new DefaultRequestToViewNameTranslator());

    this.flashMapManager = new SessionFlashMapManager();
    wac.addBean(DispatcherServlet.FLASH_MAP_MANAGER_BEAN_NAME, this.flashMapManager);
}
项目:bookManager    文件:ServletApplicationContextConfig.java   
@Bean
public RequestToViewNameTranslator viewNameTranslator() {
    return new DefaultRequestToViewNameTranslator();
}