public class ScriptTemplateView extends AbstractUrlBasedView
AbstractUrlBasedView
サブクラス。 設定されていない場合、Web アプリケーションコンテキストで単一の ScriptTemplateConfig
Bean を検索し、それを使用して構成されたプロパティを取得することにより、各プロパティが自動検出されます。
Nashorn JavaScript エンジンは Java 8+ を必要とし、適切に実行するために sharedEngine
プロパティを false
に設定する必要がある場合があります。詳細については、ScriptTemplateConfigurer.setSharedEngine(Boolean)
を参照してください。
ScriptTemplateConfigurer
, ScriptTemplateViewResolver
修飾子と型 | フィールドと説明 |
---|---|
static StringSE | DEFAULT_CONTENT_TYPE ビューのデフォルトのコンテンツ型。 |
logger
PATH_VARIABLES, RESPONSE_STATUS_ATTRIBUTE, SELECTED_CONTENT_TYPE
コンストラクターと説明 |
---|
ScriptTemplateView() Bean として使用するコンストラクター。 |
ScriptTemplateView(StringSE url) 指定された URL で新しい ScriptTemplateView を作成します。 |
afterPropertiesSet, getUrl, isUrlRequired, setUrl, toString
addStaticAttribute, createMergedOutputModel, createRequestContext, createTemporaryOutputStream, exposeModelAsRequestAttributes, formatViewName, generatesDownloadContent, getAttributesMap, getBeanName, getContentType, getRequestContextAttribute, getRequestToExpose, getStaticAttributes, isExposePathVariables, render, setAttributes, setAttributesCSV, setAttributesMap, setBeanName, setContentType, setExposeContextBeansAsAttributes, setExposedContextBeanNames, setExposePathVariables, setRequestContextAttribute, setResponseContentType, writeToResponse
getServletContext, getTempDir, getWebApplicationContext, initServletContext, isContextRequired, setServletContext
getApplicationContext, getMessageSourceAccessor, initApplicationContext, obtainApplicationContext, requiredContextClass, setApplicationContext
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, waitSE, waitSE, waitSE
public ScriptTemplateView()
public ScriptTemplateView(StringSE url)
public void setEngine(ScriptEngineSE engine)
ScriptTemplateConfigurer.setEngine(ScriptEngine)
のドキュメントを参照してください。public void setEngineName(StringSE engineName)
ScriptTemplateConfigurer.setEngineName(String)
のドキュメントを参照してください。public void setSharedEngine(BooleanSE sharedEngine)
ScriptTemplateConfigurer.setSharedEngine(Boolean)
のドキュメントを参照してください。public void setScripts(StringSE... scripts)
ScriptTemplateConfigurer.setScripts(String...)
のドキュメントを参照してください。public void setRenderObject(StringSE renderObject)
ScriptTemplateConfigurer.setRenderObject(String)
のドキュメントを参照してください。public void setRenderFunction(StringSE functionName)
ScriptTemplateConfigurer.setRenderFunction(String)
のドキュメントを参照してください。public void setCharset(CharsetSE charset)
ScriptTemplateConfigurer.setCharset(Charset)
のドキュメントを参照してください。public void setResourceLoaderPath(StringSE resourceLoaderPath)
ScriptTemplateConfigurer.setResourceLoaderPath(String)
のドキュメントを参照してください。protected void initApplicationContext(ApplicationContext context)
WebApplicationObjectSupport
WebApplicationContext
の場合、WebApplicationObjectSupport.initServletContext(javax.servlet.ServletContext)
を呼び出します。WebApplicationObjectSupport
の initApplicationContext
context
- 含む ApplicationContextApplicationObjectSupport.setApplicationContext(org.springframework.context.ApplicationContext)
protected ScriptEngineSE getEngine()
protected ScriptEngineSE createEngineFromName(StringSE engineName)
protected void loadScripts(ScriptEngineSE engine)
protected ScriptTemplateConfig autodetectViewConfig() throws BeansException
public boolean checkResource(LocaleSE locale) throws ExceptionSE
AbstractUrlBasedView
AbstractUrlBasedView
の checkResource
locale
- 探している希望のロケール true
。false
が存在しないことがわかっている場合 ExceptionSE
- リソースは存在するが無効である場合 (たとえば解析できませんでした)protected void prepareResponse(HttpServletRequestEE request, HttpServletResponseEE response)
AbstractView
デフォルトの実装では、HTTPS 経由でダウンロードコンテンツを送信するときに IE バグの回避策が適用されます。
AbstractView
の prepareResponse
request
- 現在の HTTP リクエスト response
- 現在の HTTP レスポンス protected void renderMergedOutputModel(MapSE<StringSE,ObjectSE> model, HttpServletRequestEE request, HttpServletResponseEE response) throws ExceptionSE
AbstractView
最初のステップは、リクエストの準備です。JSP の場合、これはモデルオブジェクトをリクエスト属性として設定することを意味します。2 番目のステップは、たとえば RequestDispatcher を介した JSP を含む、実際のビューのレンダリングです。
AbstractView
の renderMergedOutputModel
model
- 静的な属性よりも動的な値が優先される、結合された出力マップ(非 null
)request
- 現在の HTTP リクエスト response
- 現在の HTTP レスポンス ExceptionSE
- レンダリングに失敗した場合 protected StringSE getTemplate(StringSE path) throws IOExceptionSE