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

项目:devops-cstack    文件:CloudUnitApplicationContext.java   
@Bean
public ViewResolver contentNegotiatingViewResolver() {
    logger.debug("Configuring the ContentNegotiatingViewResolver");
    ContentNegotiatingViewResolver viewResolver = new ContentNegotiatingViewResolver();
    List<ViewResolver> viewResolvers = new ArrayList<ViewResolver>();

    UrlBasedViewResolver urlBasedViewResolver = new UrlBasedViewResolver();
    urlBasedViewResolver.setViewClass(JstlView.class);
    urlBasedViewResolver.setSuffix(".html");
    viewResolvers.add(urlBasedViewResolver);

    viewResolver.setViewResolvers(viewResolvers);

    List<View> defaultViews = new ArrayList<View>();
    defaultViews.add(new MappingJackson2JsonView());
    viewResolver.setDefaultViews(defaultViews);

    return viewResolver;
}
项目:flowable-engine    文件:DispatcherServletConfiguration.java   
@Bean
public ViewResolver contentNegotiatingViewResolver() {
    LOGGER.debug("Configuring the ContentNegotiatingViewResolver");
    ContentNegotiatingViewResolver viewResolver = new ContentNegotiatingViewResolver();
    List<ViewResolver> viewResolvers = new ArrayList<>();

    UrlBasedViewResolver urlBasedViewResolver = new UrlBasedViewResolver();
    urlBasedViewResolver.setViewClass(JstlView.class);
    urlBasedViewResolver.setPrefix("/WEB-INF/pages/");
    urlBasedViewResolver.setSuffix(".jsp");
    viewResolvers.add(urlBasedViewResolver);

    viewResolver.setViewResolvers(viewResolvers);

    List<View> defaultViews = new ArrayList<>();
    defaultViews.add(new MappingJackson2JsonView());
    viewResolver.setDefaultViews(defaultViews);

    return viewResolver;
}
项目:opentipbot    文件:WebAppContext.java   
@Bean
public ViewResolver contentNegotiatingViewResolver(
        ContentNegotiationManager manager) {

    List< ViewResolver > resolvers = new ArrayList<ViewResolver>();

    UrlBasedViewResolver viewResolver = new UrlBasedViewResolver();
    viewResolver.setViewClass(TilesView.class);
    resolvers.add(viewResolver);

    JsonViewResolver r2 = new JsonViewResolver();
    resolvers.add(r2);

    ContentNegotiatingViewResolver resolver = new ContentNegotiatingViewResolver();
    resolver.setViewResolvers(resolvers);
    resolver.setContentNegotiationManager(manager);
    return resolver;

}
项目:Smart-Shopping    文件:WebMvcConfig.java   
@Bean
public UrlBasedViewResolver urlBasedViewResolver() {
    UrlBasedViewResolver resolver = new UrlBasedViewResolver();
    resolver.setPrefix("/WEB-INF/views/");
    resolver.setSuffix(".jsp");
    resolver.setViewClass(JstlView.class);
    return resolver;
}
项目:Animal-Kingdom    文件:Config.java   
@Bean
public UrlBasedViewResolver setupViewResolver() {
    UrlBasedViewResolver resolver = new UrlBasedViewResolver();
    resolver.setPrefix("/WEB-INF/jsp/");
    resolver.setSuffix(".jsp");
    resolver.setViewClass(JstlView.class);
    return resolver;
}
项目:Storage-System    文件:Config.java   
@Bean
public UrlBasedViewResolver setupViewResolver() {
    UrlBasedViewResolver resolver = new UrlBasedViewResolver();
    resolver.setPrefix("/WEB-INF/jsp/");
    resolver.setSuffix(".jsp");
    resolver.setViewClass(JstlView.class);
    return resolver;
}
项目:esup-sgc    文件:ConfigInterceptor.java   
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {

    // we want to add usual model in modelAndView only when needed, ie with
    // direct html view :
    // not for download response (for example) because we don't need it
    // not for redirect view because we don't need it and we don't want that
    // they appears in the url

    if (modelAndView != null && modelAndView.hasView()) {

        boolean isViewObject = modelAndView.getView() == null;

        boolean isRedirectView = !isViewObject && modelAndView.getView() instanceof RedirectView;

        boolean viewNameStartsWithRedirect = isViewObject && modelAndView.getViewName().startsWith(UrlBasedViewResolver.REDIRECT_URL_PREFIX);

        if (!isRedirectView && !viewNameStartsWithRedirect) {

            String esupNfcTagDroidApkUrl = esupNfcTagService.getWebUrl() + "/nfc-index/download-apk";
            modelAndView.addObject("esupNfcTagDroidApkUrl", esupNfcTagDroidApkUrl);
            String esupNfcTagDesktopJarUrl = esupNfcTagService.getWebUrl() + "/nfc-index/download-jar";
            modelAndView.addObject("esupNfcTagDesktopJarUrl", esupNfcTagDesktopJarUrl);

            // modelAndView.addObject("versionEsuSgc", AppliVersion.getCacheVersion());

        }

        if(request.getParameter("size")!=null) {
            Integer size = Integer.valueOf(request.getParameter("size"));
            request.getSession().setAttribute("size_in_session", size);
        } else if(request.getSession(false)!=null && request.getSession().getAttribute("size_in_session") == null) {
            request.getSession().setAttribute("size_in_session", new Integer(10));
        }

    }
}
项目:OperatieBRP    文件:WebConfiguratie.java   
/**
 * @return ViewResolver
 */
@Bean
public UrlBasedViewResolver setupViewResolver() {
    final UrlBasedViewResolver resolver = new UrlBasedViewResolver();
    resolver.setPrefix("/");
    resolver.setSuffix(".html");
    resolver.setViewClass(JstlView.class);
    return resolver;
}
项目:yadaframework    文件:YadaGlobalAttributesInterceptor.java   
@Override
    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
        boolean isRedirectView = modelAndView!=null && modelAndView.getView() instanceof RedirectView;
//      boolean isViewObject = modelAndView.getView() == null;
        // if the view name is null then set a default value of true
        boolean viewNameStartsWithRedirect = (modelAndView!=null && modelAndView.getViewName() == null ? true
                : modelAndView!=null && modelAndView.getViewName().startsWith(UrlBasedViewResolver.REDIRECT_URL_PREFIX));
        if (modelAndView!=null && modelAndView.hasView() && !isRedirectView && !viewNameStartsWithRedirect) {
            addCommonModelData(modelAndView);
        }
    }
项目:meazza    文件:CommonModelAttributeInterceptor.java   
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
        ModelAndView modelAndView) throws Exception {
    // 如果不存在 ModelAndView 或者 ModelAndView 里没有指定 View,则直接返回
    if (modelAndView == null || !modelAndView.hasView()) {
        if (logger.isDebugEnabled()) {
            logger.debug("Request {} has no modelAndView.", request.getRequestURI());
        }
        return;
    }

    String viewName = modelAndView.getViewName();
    boolean isRedirectView = (modelAndView.getView() instanceof RedirectView)
            || (viewName != null && viewName.startsWith(UrlBasedViewResolver.REDIRECT_URL_PREFIX));
    if (logger.isDebugEnabled()) {
        logger.debug("Request {} {} a redirect uri.", request.getRequestURI(), isRedirectView ? "is" : "is not");
    }

    // 如果 ModelAndView 是 Redirect 方式,则直接返回
    if (isRedirectView) {
        return;
    }

    // 添加公共属性到 Model 中
    addCommonModelData(request, modelAndView);
    if (logger.isDebugEnabled()) {
        logger.debug("Added common model data for {}.", request.getRequestURI());
    }
}
项目:AnimalKingdom    文件:Config.java   
@Bean
public UrlBasedViewResolver setupViewResolver() {
    UrlBasedViewResolver resolver = new UrlBasedViewResolver();
    resolver.setPrefix("/WEB-INF/jsp/");
    resolver.setSuffix(".jsp");
    resolver.setViewClass(JstlView.class);
    return resolver;
}
项目:lti-attendance    文件:AppConfig.java   
@Bean
public UrlBasedViewResolver setupViewResolver() {
    UrlBasedViewResolver resolver = new UrlBasedViewResolver();
    resolver.setPrefix("/WEB-INF/jsp/");
    resolver.setSuffix(".jsp");
    resolver.setViewClass(JstlView.class);
    return resolver;
}
项目:lti-attendance    文件:TestSpringMVCConfig.java   
@Bean
public UrlBasedViewResolver setupViewResolver() {
    UrlBasedViewResolver resolver = new UrlBasedViewResolver();
    resolver.setPrefix("/WEB-INF/jsp/");
    resolver.setSuffix(".jsp");
    resolver.setViewClass(JstlView.class);
    return resolver;
}
项目:lti-attendance    文件:ArquillianSpringMVCConfig.java   
@Bean
public UrlBasedViewResolver setupViewResolver() {
    UrlBasedViewResolver resolver = new UrlBasedViewResolver();
    resolver.setPrefix("/WEB-INF/jsp/");
    resolver.setSuffix(".jsp");
    resolver.setViewClass(JstlView.class);
    return resolver;
}
项目:hanbit-gradle-book-example    文件:WebConfig.java   
@Bean
public UrlBasedViewResolver setupViewResolver() {
    UrlBasedViewResolver resolver = new UrlBasedViewResolver();
    resolver.setPrefix("/WEB-INF/views/");
    resolver.setSuffix(".jsp");
    resolver.setViewClass(JstlView.class);
    return resolver;
}
项目:hanbit-gradle-book-example    文件:WebConfig.java   
@Bean
public UrlBasedViewResolver setupViewResolver() {
    UrlBasedViewResolver resolver = new UrlBasedViewResolver();
    resolver.setPrefix("/WEB-INF/views/");
    resolver.setSuffix(".jsp");
    resolver.setViewClass(JstlView.class);
    return resolver;
}
项目:SpringRESTDemo    文件:WebApplicationConfig.java   
@Bean
public UrlBasedViewResolver setUpJSPViewResolver() {
    UrlBasedViewResolver urlBasedViewResolver = new UrlBasedViewResolver();
    urlBasedViewResolver.setSuffix(".jsp");
    urlBasedViewResolver.setPrefix("/");
    urlBasedViewResolver.setViewClass(JstlView.class);
    return urlBasedViewResolver;
}
项目:springfield    文件:WebmvcRenderConfiguration.java   
@Bean
public UrlBasedViewResolver springfieldWebmvcRenderTilesView()throws Exception{
    UrlBasedViewResolver bean = new UrlBasedViewResolver();
    bean.setViewClass(TilesView.class);
    bean.setOrder(Ordered.LOWEST_PRECEDENCE);
    return bean;
}
项目:springfield    文件:ContextWebmvcBase.java   
@Bean
public UrlBasedViewResolver springfieldTilesView()throws Exception{
    UrlBasedViewResolver bean = new UrlBasedViewResolver();
    bean.setViewClass(TilesView.class);
    bean.setOrder(Ordered.LOWEST_PRECEDENCE);
    return bean;
}
项目:spring-agora-web    文件:WebConfig.java   
@Bean
public UrlBasedViewResolver tilesViewResolver() 
{
    UrlBasedViewResolver bean = new UrlBasedViewResolver();
    bean.setViewClass(org.springframework.web.servlet.view.tiles3.TilesView.class);
    return bean;
}
项目:academico    文件:WebflowConfig.java   
@Bean
public UrlBasedViewResolver faceletsViewResolver() {
    UrlBasedViewResolver resolver = new UrlBasedViewResolver();
    resolver.setViewClass(JsfView.class);
    resolver.setPrefix("/WEB-INF/views/");
    resolver.setSuffix(".xhtml");
    return resolver;
}
项目:thymeleaf-tdd    文件:ThymesheetConfig.java   
@Bean
public UrlBasedViewResolver urlBasedViewResolver() {
    UrlBasedViewResolver viewResolver = new UrlBasedViewResolver();

    viewResolver.setOrder(2);
    viewResolver.setViewClass(org.springframework.web.servlet.view.InternalResourceView.class);

    return viewResolver;
}
项目:bitran    文件:Config.java   
@Bean
public UrlBasedViewResolver setupViewResolver(){
    UrlBasedViewResolver ubvr = new UrlBasedViewResolver();
    ubvr.setPrefix("/WEB-INF/jsp/");
    ubvr.setSuffix(".jsp");
    ubvr.setViewClass(JstlView.class);
    return ubvr;
}
项目:MyBot    文件:SpringDemoWebApplication.java   
@Bean
public UrlBasedViewResolver viewResolver() {
    UrlBasedViewResolver resolver = new UrlBasedViewResolver();
    resolver.setViewClass(JstlView.class);
    resolver.setPrefix("/WEB-INF/jsp/");
    resolver.setSuffix(".jsp");
    return resolver;
}
项目:spring-xml-free-example    文件:PuzzleSolvingWebMvcConfig.java   
@Bean
public UrlBasedViewResolver setupViewResolver() {
    UrlBasedViewResolver resolver = new UrlBasedViewResolver();
    resolver.setPrefix("/WEB-INF/pages/");
    resolver.setSuffix(".jsp");
    resolver.setViewClass(JstlView.class);
    return resolver;
}
项目:SE    文件:Config.java   
@Bean
public UrlBasedViewResolver setupViewResolver(){
    UrlBasedViewResolver resolver = new UrlBasedViewResolver();
    resolver.setPrefix("/WEB-INF/vista/");
    resolver.setSuffix(".jsp");
    resolver.setViewClass(JstlView.class);

    return resolver;

}
项目:spring-crud-programmatically    文件:WebAppConfig.java   
@Bean
  public UrlBasedViewResolver setupViewResolver() 
  {
UrlBasedViewResolver resolver = new UrlBasedViewResolver();
resolver.setPrefix("/WEB-INF/pages/");
resolver.setSuffix(".jsp");
resolver.setViewClass(JstlView.class);
return resolver;
  }
项目:maven-framework-project    文件:WebConfig.java   
@Bean
public UrlBasedViewResolver setupViewResolver() {
    UrlBasedViewResolver resolver = new UrlBasedViewResolver();
    resolver.setPrefix("/WEB-INF/pages/");
    resolver.setSuffix(".jsp");
    resolver.setViewClass(JstlView.class);
    return resolver;
}
项目:spring-crud-programmatically    文件:WebAppConfig.java   
@Bean
  public UrlBasedViewResolver setupViewResolver() 
  {
UrlBasedViewResolver resolver = new UrlBasedViewResolver();
resolver.setPrefix("/WEB-INF/pages/");
resolver.setSuffix(".jsp");
resolver.setViewClass(JstlView.class);
return resolver;
  }
项目:electionsms    文件:AppConfig.java   
@Bean
public UrlBasedViewResolver setupViewResolver() {
    UrlBasedViewResolver resolver = new UrlBasedViewResolver();
    resolver.setPrefix("/WEB-INF/pages/");
    resolver.setSuffix(".jsp");
    resolver.setViewClass(JstlView.class);
    return resolver;
}
项目:spring4-understanding    文件:UrlBasedViewResolverRegistration.java   
public UrlBasedViewResolverRegistration(UrlBasedViewResolver viewResolver) {
    this.viewResolver = viewResolver;
}
项目:spring4-understanding    文件:UrlBasedViewResolverRegistration.java   
protected UrlBasedViewResolver getViewResolver() {
    return this.viewResolver;
}
项目:lognavigator    文件:CommandController.java   
@RequestMapping("/logs/{logAccessConfigId}/command")
public String executeCommand(Model model,
                  HttpServletRequest request,
                  @PathVariable String logAccessConfigId, 
                  @RequestParam(value="cmd", required=false, defaultValue=DEFAULT_LIST_COMMAND) String cmd,
                  @RequestParam(value="encoding", required=false) String encoding,
                  @RequestParam(value="displayType", required=false) DisplayType displayType
) throws AuthorizationException, LogAccessException, IOException {

    // Parse command line
    CommandLine commandLine = CommandLineParser.parseCommandLine(cmd);

    // Is command forbidden ?
    checkForbiddenCommand(commandLine);

    // Forward to 'list' action, if command is 'ls'
    if ((displayType == null || displayType == DisplayType.TABLE) && commandLine.getCommand().equals(DEFAULT_LIST_COMMAND) && !cmd.contains("|")) {
        if (commandLine.hasParams()) {
            return UrlBasedViewResolver.FORWARD_URL_PREFIX + FOLDER_VIEW_URL_PREFIX + commandLine.getParam(0);
        }
        else {
            return UrlBasedViewResolver.FORWARD_URL_PREFIX + LOGS_LIST_URL;
        }
    }

    // Define default encoding when not given by client
    if (encoding == null) {
        encoding = configService.getDefaultEncoding(logAccessConfigId);
    }

    // Define default displayType when not given by client
    if (displayType == null) {
        if (cmd.startsWith(TAR_GZ_FILE_VIEW_COMMAND_START) || cmd.endsWith(TAR_GZ_FILE_VIEW_COMMAND_END)) {
            displayType = DisplayType.TABLE;
        }
        else {
            displayType = DisplayType.RAW;
        }
    }

    // Add options to model
    request.setAttribute(SHOW_OPTIONS_KEY, true);
    request.setAttribute(ENCODING_KEY, encoding);
    request.setAttribute(DISPLAY_TYPE_KEY, displayType);

    // Generate Breadcrumbs
    generateBreadcrumbs(logAccessConfigId, commandLine, request);

    // Execute the command
    InputStream resultStream = logAccessService.executeCommand(logAccessConfigId, cmd);
    BufferedReader resultReader = new BufferedReader(new InputStreamReader(resultStream, encoding));

    // Process the result lines for raw display
    if (displayType == DisplayType.RAW) {
        model.addAttribute(RAW_CONTENT_KEY, resultReader);
        return VIEW_RAW;
    }

    // Process the result lines for html table display
    else {
        try {
            if (cmd.startsWith(TAR_GZ_FILE_VIEW_COMMAND_START) || cmd.endsWith(TAR_GZ_FILE_VIEW_COMMAND_END)) {
                return processTarGzList(resultReader, model, cmd);
            }
            else {
                processOtherCommand(resultReader, model);
            }
        }
        finally {
            IOUtils.closeQuietly(resultReader);
        }
        return VIEW_TABLE;
    }
}
项目:Spring-Blog-Cms    文件:RootMvcConfiguration.java   
@Bean
public UrlBasedViewResolver tilesViewResolver() {
    UrlBasedViewResolver viewResolver = new UrlBasedViewResolver();
    viewResolver.setViewClass(TilesView.class);
    return viewResolver;
}
项目:class-guard    文件:JavaConfigTests.java   
@Bean
public UrlBasedViewResolver urlBasedViewResolver() {
    UrlBasedViewResolver resolver = new UrlBasedViewResolver();
    resolver.setViewClass(TilesView.class);
    return resolver;
}
项目:esup-dematec    文件:ConfigInterceptor.java   
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {

    // we want to add usual model in modelAndView only when needed, ie with
    // direct html view :
    // not for download response (for example) because we don't need it
    // not for redirect view because we don't need it and we don't want that
    // they appears in the url

    if (modelAndView != null && modelAndView.hasView()) {

        boolean isViewObject = modelAndView.getView() == null;

        boolean isRedirectView = !isViewObject && modelAndView.getView() instanceof RedirectView;

        boolean viewNameStartsWithRedirect = isViewObject && modelAndView.getViewName().startsWith(UrlBasedViewResolver.REDIRECT_URL_PREFIX);

        if (!isRedirectView && !viewNameStartsWithRedirect) {

            String title = AppliConfig.getCacheTitre();
            modelAndView.addObject("title", title);

            String piedPage = AppliConfig.getCachePiedPage();
            modelAndView.addObject("piedPage", piedPage);

            String imageUrl = AppliConfig.getCacheImageUrl();
            modelAndView.addObject("imageUrl", imageUrl);

            String path = request.getServletPath();
            String subTitle = subTitles.get(path);
            String activeMenu = path.replaceAll("/", "");

            if (subTitle == null) {
                List<String> keys = new Vector<String>(subTitles.keySet());
                Collections.reverse(keys);
                for (String key : keys) {
                    if (path.startsWith(key)) {
                        subTitle = subTitles.get(key);
                        ;
                        activeMenu = key.replaceAll("/", "");
                        break;
                    }
                }
            }

            modelAndView.addObject("subTitle", subTitle);
            modelAndView.addObject("activeMenu", activeMenu);

            modelAndView.addObject("candidatCanSignup", AppliConfig.getCacheCandidatCanSignup());

            modelAndView.addObject("postesMenu4Members", AppliConfig.getCachePostesMenu4Members());

            modelAndView.addObject("versionEsupDematEC", AppliVersion.getCacheVersion());

        }

        if(request.getParameter("size")!=null) {
            Integer size = Integer.valueOf(request.getParameter("size"));
            request.getSession().setAttribute("size_in_session", size);
        } else if(request.getSession(false)!=null && request.getSession().getAttribute("size_in_session") == null) {
            request.getSession().setAttribute("size_in_session", new Integer(40));
        }

    }
}