类 ScriptTemplateView
java.lang.Object
cn.taketoday.context.support.ApplicationObjectSupport
cn.taketoday.web.view.AbstractView
cn.taketoday.web.view.AbstractUrlBasedView
cn.taketoday.web.view.script.ScriptTemplateView
- 所有已实现的接口:
cn.taketoday.beans.factory.Aware,cn.taketoday.beans.factory.BeanNameAware,cn.taketoday.beans.factory.InitializingBean,cn.taketoday.context.ApplicationContextAware,View
An
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.
- 从以下版本开始:
- 4.0
- 作者:
- Sebastien Deleuze, Juergen Hoeller, Harry Yang
- 另请参阅:
-
嵌套类概要
嵌套类修饰符和类型类说明private static final recordKey class for theenginesHolder ThreadLocal. -
字段概要
字段修饰符和类型字段说明private Charsetprivate static final Charsetstatic final StringThe default content type for the view.private static final Stringprivate ScriptEngineprivate Stringprivate static final cn.taketoday.core.NamedThreadLocal<Map<Object,ScriptEngine>> private Supplier<ScriptEngine>private Stringprivate Stringprivate String[]private ScriptEngineManagerprivate String[]private Boolean从类继承的字段 cn.taketoday.context.support.ApplicationObjectSupport
applicationContext, log, messageSourceAccessor从接口继承的字段 cn.taketoday.web.view.View
RESPONSE_STATUS_ATTRIBUTE, SELECTED_CONTENT_TYPE -
构造器概要
构造器构造器说明Constructor for use as a bean.ScriptTemplateView(String url) Create a new ScriptTemplateView with the given URL. -
方法概要
修饰符和类型方法说明protected ScriptTemplateConfigbooleancheckResource(Locale locale) Check whether the underlying resource that the configured URL points to actually exists.protected ScriptEnginecreateEngineFromName(String engineName) private ScriptEngineprotected ScriptEngineprotected cn.taketoday.core.io.ResourcegetResource(String location) protected StringgetTemplate(String path) protected voidinitApplicationContext(cn.taketoday.context.ApplicationContext context) protected voidloadScripts(ScriptEngine engine) protected voidprepareResponse(RequestContext context) Prepare the given response for rendering.protected voidrenderMergedOutputModel(Map<String, Object> model, RequestContext request) Subclasses must implement this method to actually render the view.voidsetCharset(Charset charset) SeeScriptTemplateConfigurer.setCharset(Charset)documentation.voidsetEngine(ScriptEngine engine) SeeScriptTemplateConfigurer.setEngine(ScriptEngine)documentation.voidsetEngineName(String engineName) SeeScriptTemplateConfigurer.setEngineName(String)documentation.voidsetEngineSupplier(Supplier<ScriptEngine> engineSupplier) SeeScriptTemplateConfigurer.setEngineSupplier(Supplier)documentation.voidsetRenderFunction(String functionName) SeeScriptTemplateConfigurer.setRenderFunction(String)documentation.voidsetRenderObject(String renderObject) SeeScriptTemplateConfigurer.setRenderObject(String)documentation.voidsetResourceLoaderPath(String resourceLoaderPath) SeeScriptTemplateConfigurer.setResourceLoaderPath(String)documentation.voidsetScripts(String... scripts) SeeScriptTemplateConfigurer.setScripts(String...)documentation.voidsetSharedEngine(Boolean sharedEngine) SeeScriptTemplateConfigurer.setSharedEngine(Boolean)documentation.从类继承的方法 cn.taketoday.web.view.AbstractUrlBasedView
afterPropertiesSet, getUrl, isUrlRequired, setUrl, toString从类继承的方法 cn.taketoday.web.view.AbstractView
addStaticAttribute, createMergedOutputModel, createTemporaryOutputStream, exposeModelAsRequestAttributes, formatViewName, generatesDownloadContent, getAttributesMap, getBeanName, getContentType, getRequestContextAttribute, getRequestContextToExpose, getStaticAttributes, isExposePathVariables, render, setAttributes, setAttributesCSV, setAttributesMap, setBeanName, setContentType, setExposeContextBeansAsAttributes, setExposedContextBeanNames, setExposeOutputRedirectModel, setExposePathVariables, setRequestContextAttribute, setResponseContentType, writeToResponse从类继承的方法 cn.taketoday.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, initApplicationContext, isContextRequired, obtainApplicationContext, requiredContextClass, setApplicationContext, unwrapContext, unwrapFactory
-
字段详细资料
-
构造器详细资料
-
ScriptTemplateView
public ScriptTemplateView()Constructor for use as a bean. -
ScriptTemplateView
Create a new ScriptTemplateView with the given URL.
-
-
方法详细资料
-
setEngine
SeeScriptTemplateConfigurer.setEngine(ScriptEngine)documentation. -
setEngineSupplier
SeeScriptTemplateConfigurer.setEngineSupplier(Supplier)documentation. -
setEngineName
SeeScriptTemplateConfigurer.setEngineName(String)documentation. -
setScripts
SeeScriptTemplateConfigurer.setScripts(String...)documentation. -
setRenderObject
SeeScriptTemplateConfigurer.setRenderObject(String)documentation. -
setRenderFunction
SeeScriptTemplateConfigurer.setRenderFunction(String)documentation. -
setCharset
SeeScriptTemplateConfigurer.setCharset(Charset)documentation. -
setResourceLoaderPath
SeeScriptTemplateConfigurer.setResourceLoaderPath(String)documentation. -
initApplicationContext
protected void initApplicationContext(cn.taketoday.context.ApplicationContext context) - 覆盖:
initApplicationContext在类中cn.taketoday.context.support.ApplicationObjectSupport
-
getEngine
-
createEngineFromName
-
createEngineFromSupplier
-
loadScripts
-
getResource
-
autodetectViewConfig
- 抛出:
cn.taketoday.beans.BeansException
-
checkResource
从类复制的说明:AbstractUrlBasedViewCheck whether the underlying resource that the configured URL points to actually exists.- 覆盖:
checkResource在类中AbstractUrlBasedView- 参数:
locale- the desired Locale that we're looking for- 返回:
trueif the resource exists (or is assumed to exist);falseif we know that it does not exist
-
prepareResponse
从类复制的说明:AbstractViewPrepare the given response for rendering.The default implementation applies a workaround for an IE bug when sending download content via HTTPS.
- 覆盖:
prepareResponse在类中AbstractView- 参数:
context- current HTTP request context
-
renderMergedOutputModel
protected void renderMergedOutputModel(Map<String, Object> model, RequestContext request) throws Exception从类复制的说明:AbstractViewSubclasses must implement this method to actually render the view.The first step will be preparing the request: In the JSP case, this would mean setting model objects as request attributes. The second step will be the actual rendering of the view, for example including the JSP via a RequestDispatcher.
- 指定者:
renderMergedOutputModel在类中AbstractView- 参数:
model- combined output Map (nevernull), with dynamic values taking precedence over static attributesrequest- current HTTP request context- 抛出:
Exception- if rendering failed
-
getTemplate
- 抛出:
IOException
-