org.springframework.web.reactive.result.view.script.ScriptTemplateConfigurer Java Examples

The following examples show how to use org.springframework.web.reactive.result.view.script.ScriptTemplateConfigurer. 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 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 #2
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 #3
Source File: ViewResolverRegistryTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Before
public void setup() {
	StaticWebApplicationContext context = new StaticWebApplicationContext();
	context.registerSingleton("freeMarkerConfigurer", FreeMarkerConfigurer.class);
	context.registerSingleton("scriptTemplateConfigurer", ScriptTemplateConfigurer.class);
	this.registry = new ViewResolverRegistry(context);
}
 
Example #4
Source File: ViewResolverRegistryTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Before
public void setup() {
	StaticWebApplicationContext context = new StaticWebApplicationContext();
	context.registerSingleton("freeMarkerConfigurer", FreeMarkerConfigurer.class);
	context.registerSingleton("scriptTemplateConfigurer", ScriptTemplateConfigurer.class);
	this.registry = new ViewResolverRegistry(context);
}
 
Example #5
Source File: WebfluxConfig.java    From Hands-On-Reactive-Programming-with-Reactor with MIT License 5 votes vote down vote up
@Bean
public ScriptTemplateConfigurer scrptTemplateConfigurer() {
    ScriptTemplateConfigurer configurer = new ScriptTemplateConfigurer();
    configurer.setEngineName("nashorn");
    configurer.setScripts("mustache.js");
    configurer.setRenderObject("Mustache");
    configurer.setResourceLoaderPath("classpath:/mustache/");
    configurer.setRenderFunction("render");
    return configurer;
}
 
Example #6
Source File: WebfluxConfig.java    From Hands-On-Reactive-Programming-with-Reactor with MIT License 5 votes vote down vote up
@Bean
public ScriptTemplateConfigurer scrptTemplateConfigurer() {
    ScriptTemplateConfigurer configurer = new ScriptTemplateConfigurer();
    configurer.setEngineName("nashorn");
    configurer.setScripts("mustache.js");
    configurer.setRenderObject("Mustache");
    configurer.setResourceLoaderPath("classpath:/mustache/");
    configurer.setRenderFunction("render");
    return configurer;
}
 
Example #7
Source File: WebfluxConfig.java    From Hands-On-Reactive-Programming-with-Reactor with MIT License 5 votes vote down vote up
@Bean
public ScriptTemplateConfigurer scrptTemplateConfigurer() {
    ScriptTemplateConfigurer configurer = new ScriptTemplateConfigurer();
    configurer.setEngineName("nashorn");
    configurer.setScripts("mustache.js");
    configurer.setRenderObject("Mustache");
    configurer.setResourceLoaderPath("classpath:/mustache/");
    configurer.setRenderFunction("render");
    return configurer;
}
 
Example #8
Source File: WebfluxConfig.java    From Hands-On-Reactive-Programming-with-Reactor with MIT License 5 votes vote down vote up
@Bean
public ScriptTemplateConfigurer scrptTemplateConfigurer() {
    ScriptTemplateConfigurer configurer = new ScriptTemplateConfigurer();
    configurer.setEngineName("nashorn");
    configurer.setScripts("mustache.js");
    configurer.setRenderObject("Mustache");
    configurer.setResourceLoaderPath("classpath:/mustache/");
    configurer.setRenderFunction("render");
    return configurer;
}
 
Example #9
Source File: WebfluxConfig.java    From Hands-On-Reactive-Programming-with-Reactor with MIT License 5 votes vote down vote up
@Bean
public ScriptTemplateConfigurer scrptTemplateConfigurer() {
    ScriptTemplateConfigurer configurer = new ScriptTemplateConfigurer();
    configurer.setEngineName("nashorn");
    configurer.setScripts("mustache.js");
    configurer.setRenderObject("Mustache");
    configurer.setResourceLoaderPath("classpath:/mustache/");
    configurer.setRenderFunction("render");
    return configurer;
}