AbstractUrlBasedView subclass designed to run any template library
based on a JSR-223 script engine.
If not set, each property is auto-detected by looking up a single
ScriptTemplateConfig bean in the web application context and using
it to obtain the configured properties.
The Nashorn JavaScript engine requires Java 8+ and may require setting the
sharedEngine property to false in order to run properly. See
ScriptTemplateConfigurer#setSharedEngine(Boolean) for more details.
ScriptTemplateConfigurer, ScriptTemplateViewResolver
| Modifier and Type | Field and Description |
|---|---|
| private static final String | |
| private ScriptEngine | |
| private String | |
| private Supplier | |
| private String | |
| private String | |
| private String[] | |
| private volatile ScriptEngineManager | |
| private String[] | |
| private Boolean |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected ScriptTemplateConfig | |
| public boolean | checkResourceExists(Locale
the desired Locale that we're looking for locale)Implements abstract org. Check whether the resource for the configured URL actually exists. |
| protected ScriptEngine | |
| private ScriptEngine | |
| protected ScriptEngine | |
| protected Resource | |
| protected String | |
| protected void | |
| protected Mono | renderInternal(Map<String, Object>
combined output Map (never model, MediaType null),
with dynamic values taking precedence over static attributesthe content type selected to render with, which should
match one of the supported media types contentType, ServerWebExchange current exchange exchange)Implements abstract org. Subclasses must implement this method to actually render the view. |
| public void | setApplicationContext(ApplicationContext
the ApplicationContext object to be used by this object context)Overrides org. Implements org. Set the ApplicationContext that this object runs in. Normally this call will be used to initialize the object. |
| public void | |
| public void | |
| public void | setEngineSupplier(Supplier<ScriptEngine> engineSupplier)
See |
| public void | setRenderFunction(String functionName)
See |
| public void | setRenderObject(String renderObject)
See |
| public void | setResourceLoaderPath(String resourceLoaderPath)
See |
| public void | |
| public void | setSharedEngine(Boolean sharedEngine)
See |
| DEFAULT_RESOURCE_LOADER_PATH | back to summary |
|---|---|
| private static final String DEFAULT_RESOURCE_LOADER_PATH | |
| engine | back to summary |
|---|---|
| private ScriptEngine engine
| |
| engineName | back to summary |
|---|---|
| private String engineName
| |
| engineSupplier | back to summary |
|---|---|
| private Supplier<ScriptEngine> engineSupplier
| |
| renderFunction | back to summary |
|---|---|
| private String renderFunction
| |
| renderObject | back to summary |
|---|---|
| private String renderObject
| |
| resourceLoaderPaths | back to summary |
|---|---|
| private String[] resourceLoaderPaths
| |
| scriptEngineManager | back to summary |
|---|---|
| private volatile ScriptEngineManager scriptEngineManager
| |
| scripts | back to summary |
|---|---|
| private String[] scripts
| |
| sharedEngine | back to summary |
|---|---|
| private Boolean sharedEngine
| |
| ScriptTemplateView | back to summary |
|---|---|
| public ScriptTemplateView() Constructor for use as a bean.
| |
| ScriptTemplateView | back to summary |
|---|---|
| public ScriptTemplateView(String url) Create a new ScriptTemplateView with the given URL. | |
| autodetectViewConfig | back to summary |
|---|---|
| protected ScriptTemplateConfig autodetectViewConfig() throws BeansException | |
| checkResourceExists | back to summary |
|---|---|
| public boolean checkResourceExists(Locale locale) throws Exception Implements abstract org. Doc from org. Check whether the resource for the configured URL actually exists. | |
| createEngineFromName | back to summary |
|---|---|
| protected ScriptEngine createEngineFromName(String engineName) | |
| createEngineFromSupplier | back to summary |
|---|---|
| private ScriptEngine createEngineFromSupplier() | |
| getEngine | back to summary |
|---|---|
| protected ScriptEngine getEngine() | |
| getResource | back to summary |
|---|---|
protected Resource getResource(String location)
| |
| getTemplate | back to summary |
|---|---|
| protected String getTemplate(String path) throws IOException | |
| loadScripts | back to summary |
|---|---|
| protected void loadScripts(ScriptEngine engine) | |
| renderInternal | back to summary |
|---|---|
| protected Mono Implements abstract org. Doc from org. Subclasses must implement this method to actually render the view.
| |
| setApplicationContext | back to summary |
|---|---|
| public void setApplicationContext(ApplicationContext context) Overrides org. Implements org. Doc from org. Set the ApplicationContext that this object runs in. Normally this call will be used to initialize the object. Invoked after population of normal bean properties but before an init callback such
as
| |
| setEngine | back to summary |
|---|---|
| public void setEngine(ScriptEngine engine) See | |
| setEngineName | back to summary |
|---|---|
| public void setEngineName(String engineName) See | |
| setEngineSupplier | back to summary |
|---|---|
| public void setEngineSupplier(Supplier<ScriptEngine> engineSupplier) See
| |
| setRenderFunction | back to summary |
|---|---|
| public void setRenderFunction(String functionName) See | |
| setRenderObject | back to summary |
|---|---|
| public void setRenderObject(String renderObject) See | |
| setResourceLoaderPath | back to summary |
|---|---|
| public void setResourceLoaderPath(String resourceLoaderPath) See | |
| setScripts | back to summary |
|---|---|
| public void setScripts(String... scripts) See | |
| setSharedEngine | back to summary |
|---|---|
| public void setSharedEngine(Boolean sharedEngine) See | |