org.springframework.web.reactive.result.view.UrlBasedViewResolver Java Examples

The following examples show how to use org.springframework.web.reactive.result.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: ViewResolverRegistry.java    From spring-analysis-note with MIT License 6 votes vote down vote up
/**
 * Register a {@code FreeMarkerViewResolver} with a ".ftl" suffix.
 * <p><strong>Note</strong> that you must also configure FreeMarker by
 * adding a {@link FreeMarkerConfigurer} bean.
 */
public UrlBasedViewResolverRegistration freeMarker() {
	if (!checkBeanOfType(FreeMarkerConfigurer.class)) {
		throw new BeanInitializationException("In addition to a FreeMarker view resolver " +
				"there must also be a single FreeMarkerConfig bean in this web application context " +
				"(or its parent): FreeMarkerConfigurer is the usual implementation. " +
				"This bean may be given any name.");
	}
	FreeMarkerRegistration registration = new FreeMarkerRegistration();
	UrlBasedViewResolver resolver = registration.getViewResolver();
	if (this.applicationContext != null) {
		resolver.setApplicationContext(this.applicationContext);
	}
	this.viewResolvers.add(resolver);
	return registration;
}
 
Example #2
Source File: ViewResolverRegistry.java    From spring-analysis-note with MIT License 6 votes vote down vote up
/**
 * Register a script template view resolver with an empty default view name prefix and suffix.
 * <p><strong>Note</strong> that you must also configure script templating by
 * adding a {@link ScriptTemplateConfigurer} bean.
 * @since 5.0.4
 */
public UrlBasedViewResolverRegistration scriptTemplate() {
	if (!checkBeanOfType(ScriptTemplateConfigurer.class)) {
		throw new BeanInitializationException("In addition to a script template view resolver " +
				"there must also be a single ScriptTemplateConfig bean in this web application context " +
				"(or its parent): ScriptTemplateConfigurer is the usual implementation. " +
				"This bean may be given any name.");
	}
	ScriptRegistration registration = new ScriptRegistration();
	UrlBasedViewResolver resolver = registration.getViewResolver();
	if (this.applicationContext != null) {
		resolver.setApplicationContext(this.applicationContext);
	}
	this.viewResolvers.add(resolver);
	return registration;
}
 
Example #3
Source File: ViewResolverRegistry.java    From java-technology-stack with MIT License 6 votes vote down vote up
/**
 * Register a {@code FreeMarkerViewResolver} with a ".ftl" suffix.
 * <p><strong>Note</strong> that you must also configure FreeMarker by
 * adding a {@link FreeMarkerConfigurer} bean.
 */
public UrlBasedViewResolverRegistration freeMarker() {
	if (!checkBeanOfType(FreeMarkerConfigurer.class)) {
		throw new BeanInitializationException("In addition to a FreeMarker view resolver " +
				"there must also be a single FreeMarkerConfig bean in this web application context " +
				"(or its parent): FreeMarkerConfigurer is the usual implementation. " +
				"This bean may be given any name.");
	}
	FreeMarkerRegistration registration = new FreeMarkerRegistration();
	UrlBasedViewResolver resolver = registration.getViewResolver();
	if (this.applicationContext != null) {
		resolver.setApplicationContext(this.applicationContext);
	}
	this.viewResolvers.add(resolver);
	return registration;
}
 
Example #4
Source File: ViewResolverRegistry.java    From java-technology-stack with MIT License 6 votes vote down vote up
/**
 * Register a script template view resolver with an empty default view name prefix and suffix.
 * <p><strong>Note</strong> that you must also configure script templating by
 * adding a {@link ScriptTemplateConfigurer} bean.
 * @since 5.0.4
 */
public UrlBasedViewResolverRegistration scriptTemplate() {
	if (!checkBeanOfType(ScriptTemplateConfigurer.class)) {
		throw new BeanInitializationException("In addition to a script template view resolver " +
				"there must also be a single ScriptTemplateConfig bean in this web application context " +
				"(or its parent): ScriptTemplateConfigurer is the usual implementation. " +
				"This bean may be given any name.");
	}
	ScriptRegistration registration = new ScriptRegistration();
	UrlBasedViewResolver resolver = registration.getViewResolver();
	if (this.applicationContext != null) {
		resolver.setApplicationContext(this.applicationContext);
	}
	this.viewResolvers.add(resolver);
	return registration;
}
 
Example #5
Source File: ViewResolverRegistryTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void customViewResolver() {
	UrlBasedViewResolver viewResolver = new UrlBasedViewResolver();
	this.registry.viewResolver(viewResolver);

	assertSame(viewResolver, this.registry.getViewResolvers().get(0));
	assertEquals(1, this.registry.getViewResolvers().size());
}
 
Example #6
Source File: ViewResolverRegistryTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void customViewResolver() {
	UrlBasedViewResolver viewResolver = new UrlBasedViewResolver();
	this.registry.viewResolver(viewResolver);

	assertSame(viewResolver, this.registry.getViewResolvers().get(0));
	assertEquals(1, this.registry.getViewResolvers().size());
}
 
Example #7
Source File: UrlBasedViewResolverRegistration.java    From spring-analysis-note with MIT License 4 votes vote down vote up
public UrlBasedViewResolverRegistration(UrlBasedViewResolver viewResolver) {
	Assert.notNull(viewResolver, "ViewResolver must not be null");
	this.viewResolver = viewResolver;
}
 
Example #8
Source File: UrlBasedViewResolverRegistration.java    From spring-analysis-note with MIT License 4 votes vote down vote up
protected UrlBasedViewResolver getViewResolver() {
	return this.viewResolver;
}
 
Example #9
Source File: UrlBasedViewResolverRegistration.java    From java-technology-stack with MIT License 4 votes vote down vote up
public UrlBasedViewResolverRegistration(UrlBasedViewResolver viewResolver) {
	Assert.notNull(viewResolver, "ViewResolver must not be null");
	this.viewResolver = viewResolver;
}
 
Example #10
Source File: UrlBasedViewResolverRegistration.java    From java-technology-stack with MIT License 4 votes vote down vote up
protected UrlBasedViewResolver getViewResolver() {
	return this.viewResolver;
}