public abstract class AbstractTemplateView extends AbstractUrlBasedView
JSP/JSTL およびその他のビューテクノロジーは自動的に HttpServletRequest オブジェクトにアクセスし、現在のユーザーのリクエスト / セッション属性にアクセスします。さらに、ヘルパーオブジェクトをリクエスト属性として作成してキャッシュすることもできます。
AbstractTemplateViewResolver
, FreeMarkerView
修飾子と型 | フィールドと説明 |
---|---|
static StringSE | SPRING_MACRO_REQUEST_CONTEXT_ATTRIBUTE テンプレートモデル内の RequestContext インスタンスの変数名。Spring のマクロで使用できます。 |
DEFAULT_CONTENT_TYPE
logger
PATH_VARIABLES, RESPONSE_STATUS_ATTRIBUTE, SELECTED_CONTENT_TYPE
コンストラクターと説明 |
---|
AbstractTemplateView() |
修飾子と型 | メソッドと説明 |
---|---|
protected void | applyContentType(HttpServletResponseEE response) "contentType" Bean プロパティで指定されたこのビューのコンテンツ型を、指定されたレスポンスに適用します。 |
protected void | renderMergedOutputModel(MapSE<StringSE, ObjectSE> model, HttpServletRequestEE request, HttpServletResponseEE response) ビューを実際にレンダリングするには、サブクラスでこのメソッドを実装する必要があります。 |
protected abstract void | renderMergedTemplateModel(MapSE<StringSE, ObjectSE> model, HttpServletRequestEE request, HttpServletResponseEE response) ビューを実際にレンダリングするには、サブクラスでこのメソッドを実装する必要があります。 |
void | setAllowRequestOverride(boolean allowRequestOverride) HttpServletRequest 属性が同じ名前のコントローラー生成モデル属性をオーバーライド(非表示)できるかどうかを設定します。 |
void | setAllowSessionOverride(boolean allowSessionOverride) HttpSession 属性が同じ名前のコントローラー生成モデル属性をオーバーライド(非表示)できるかどうかを設定します。 |
void | setExposeRequestAttributes(boolean exposeRequestAttributes) テンプレートとマージする前に、すべてのリクエスト属性をモデルに追加するかどうかを設定します。 |
void | setExposeSessionAttributes(boolean exposeSessionAttributes) テンプレートとマージする前に、すべての HttpSession 属性をモデルに追加するかどうかを設定します。 |
void | setExposeSpringMacroHelpers(boolean exposeSpringMacroHelpers) Spring のマクロライブラリで使用するために、RequestContext を "springMacroRequestContext" という名前で公開するかどうかを設定します。 |
afterPropertiesSet, checkResource, getUrl, isUrlRequired, setUrl, toString
addStaticAttribute, createMergedOutputModel, createRequestContext, createTemporaryOutputStream, exposeModelAsRequestAttributes, formatViewName, generatesDownloadContent, getAttributesMap, getBeanName, getContentType, getRequestContextAttribute, getRequestToExpose, getStaticAttributes, isExposePathVariables, prepareResponse, render, setAttributes, setAttributesCSV, setAttributesMap, setBeanName, setContentType, setExposeContextBeansAsAttributes, setExposedContextBeanNames, setExposePathVariables, setRequestContextAttribute, setResponseContentType, writeToResponse
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
getApplicationContext, getMessageSourceAccessor, initApplicationContext, obtainApplicationContext, requiredContextClass, setApplicationContext
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, waitSE, waitSE, waitSE
public void setExposeRequestAttributes(boolean exposeRequestAttributes)
public void setAllowRequestOverride(boolean allowRequestOverride)
public void setExposeSessionAttributes(boolean exposeSessionAttributes)
public void setAllowSessionOverride(boolean allowSessionOverride)
public void setExposeSpringMacroHelpers(boolean exposeSpringMacroHelpers)
現在、Spring の FreeMarker デフォルトマクロに必要です。これは、Spring ヘルパーマクロを利用する場合を除き、 HTML フォームを使用するテンプレートには必要ありません。
protected final 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 void applyContentType(HttpServletResponseEE response)
レスポンスにコンテンツ型が以前に設定されていない場合にのみ、ビューの contentType を適用します。これにより、ハンドラーはデフォルトのコンテンツ型を事前にオーバーライドできます。
response
- 現在の HTTP レスポンス AbstractView.setContentType(java.lang.String)
protected abstract void renderMergedTemplateModel(MapSE<StringSE,ObjectSE> model, HttpServletRequestEE request, HttpServletResponseEE response) throws ExceptionSE
model
- 必要に応じてリクエスト属性とセッション属性がマージされた出力マップの組み合わせ request
- 現在の HTTP リクエスト response
- 現在の HTTP レスポンス ExceptionSE
- レンダリングに失敗した場合