org.springframework.web.servlet.view.UrlBasedViewResolver Java Examples

The following examples show how to use org.springframework.web.servlet.view.UrlBasedViewResolver. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DispatcherServletConfiguration.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
@Bean
public ViewResolver contentNegotiatingViewResolver() {
    log.debug("Configuring the ContentNegotiatingViewResolver");
    ContentNegotiatingViewResolver viewResolver = new ContentNegotiatingViewResolver();
    List<ViewResolver> viewResolvers = new ArrayList<ViewResolver>();

    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<View>();
    defaultViews.add(new MappingJackson2JsonView());
    viewResolver.setDefaultViews(defaultViews);

    return viewResolver;
}
 
Example #2
Source File: AppConfig.java    From tutorials with MIT License 5 votes vote down vote up
/** View resolver for JSP */
@Bean
public UrlBasedViewResolver viewResolver() {
    UrlBasedViewResolver resolver = new UrlBasedViewResolver();
    resolver.setPrefix("/WEB-INF/jsp/");
    resolver.setSuffix(".jsp");
    resolver.setViewClass(JstlView.class);
    return resolver;
}
 
Example #3
Source File: AppConfig.java    From tutorials with MIT License 5 votes vote down vote up
@Bean
public UrlBasedViewResolver viewResolver() {
    final UrlBasedViewResolver bean = new UrlBasedViewResolver();
    bean.setPrefix("/WEB-INF/jsp/");
    bean.setSuffix(".jsp");
    bean.setViewClass(JstlView.class);
    return bean;
}
 
Example #4
Source File: AppConfig.java    From tutorials with MIT License 5 votes vote down vote up
/**
 * View resolver for JSP
 */
@Bean
public UrlBasedViewResolver viewResolver() {
    UrlBasedViewResolver resolver = new UrlBasedViewResolver();
    resolver.setPrefix("/WEB-INF/jsp/");
    resolver.setSuffix(".jsp");
    resolver.setViewClass(JstlView.class);
    return resolver;
}
 
Example #5
Source File: ScopesConfig.java    From tutorials with MIT License 5 votes vote down vote up
@Bean
public UrlBasedViewResolver setupViewResolver() {
    final UrlBasedViewResolver resolver = new UrlBasedViewResolver();
    resolver.setPrefix("/WEB-INF/view/");
    resolver.setSuffix(".jsp");
    resolver.setViewClass(JstlView.class);
    return resolver;
}
 
Example #6
Source File: WebConfig.java    From maven-framework-project with MIT License 5 votes vote down vote up
@Bean
public UrlBasedViewResolver setupViewResolver() {
	UrlBasedViewResolver resolver = new UrlBasedViewResolver();
	resolver.setPrefix("/WEB-INF/pages/");
	resolver.setSuffix(".jsp");
	resolver.setViewClass(JstlView.class);
	return resolver;
}
 
Example #7
Source File: CommandController.java    From lognavigator with Apache License 2.0 4 votes vote down vote up
@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;
	}
}
 
Example #8
Source File: CrafterPageViewResolver.java    From engine with GNU General Public License v3.0 4 votes vote down vote up
protected View getRedirectView(String redirectUrl, boolean relative) {
    View view = new RedirectView(redirectUrl, relative, true);

    return applyLifecycleMethods(UrlBasedViewResolver.REDIRECT_URL_PREFIX + redirectUrl, view);
}
 
Example #9
Source File: MvcConfiguration.java    From alf.io with GNU General Public License v3.0 4 votes vote down vote up
@Bean
public ViewResolver viewResolver() {
    var resolver = new UrlBasedViewResolver();
    resolver.setViewClass(AbstractUrlBasedView.class);
    return resolver;
}
 
Example #10
Source File: ServletConfig.java    From market with MIT License 4 votes vote down vote up
@Bean
public UrlBasedViewResolver urlBasedViewResolver() {
	return new InternalResourceViewResolver("/WEB-INF/view/", ".jsp");
}
 
Example #11
Source File: UrlBasedViewResolverRegistration.java    From spring-analysis-note with MIT License 4 votes vote down vote up
public UrlBasedViewResolverRegistration(UrlBasedViewResolver viewResolver) {
	this.viewResolver = viewResolver;
}
 
Example #12
Source File: UrlBasedViewResolverRegistration.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
protected UrlBasedViewResolver getViewResolver() {
	return this.viewResolver;
}
 
Example #13
Source File: UrlBasedViewResolverRegistration.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
public UrlBasedViewResolverRegistration(UrlBasedViewResolver viewResolver) {
	this.viewResolver = viewResolver;
}
 
Example #14
Source File: UrlBasedViewResolverRegistration.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
protected UrlBasedViewResolver getViewResolver() {
	return this.viewResolver;
}
 
Example #15
Source File: UrlBasedViewResolverRegistration.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public UrlBasedViewResolverRegistration(UrlBasedViewResolver viewResolver) {
	this.viewResolver = viewResolver;
}
 
Example #16
Source File: UrlBasedViewResolverRegistration.java    From java-technology-stack with MIT License 4 votes vote down vote up
protected UrlBasedViewResolver getViewResolver() {
	return this.viewResolver;
}
 
Example #17
Source File: UrlBasedViewResolverRegistration.java    From java-technology-stack with MIT License 4 votes vote down vote up
public UrlBasedViewResolverRegistration(UrlBasedViewResolver viewResolver) {
	this.viewResolver = viewResolver;
}
 
Example #18
Source File: UrlBasedViewResolverRegistration.java    From spring-analysis-note with MIT License 4 votes vote down vote up
protected UrlBasedViewResolver getViewResolver() {
	return this.viewResolver;
}