public class MarshallingView extends AbstractView
Marshaller によるマーシャリングの結果としてレンダリングされるレスポンスコンテキストを可能にする Spring-MVC View。 マーシャリングされるオブジェクトは、モデルのパラメーターとして提供され、レスポンスのレンダリング中に検出されます。ユーザーは、sourceKey プロパティを使用してモデルの特定のエントリを指定するか、Spring に Source オブジェクトを配置させることができます。
| 修飾子と型 | フィールドと説明 |
|---|---|
static StringSE | DEFAULT_CONTENT_TYPE デフォルトのコンテンツ型。 |
loggerPATH_VARIABLES, RESPONSE_STATUS_ATTRIBUTE, SELECTED_CONTENT_TYPE| コンストラクターと説明 |
|---|
MarshallingView()Marshaller が設定されていない新しい MarshallingView を構築します。 |
MarshallingView(Marshaller marshaller) 指定された Marshaller セットで新しい MarshallingView を構築します。 |
| 修飾子と型 | メソッドと説明 |
|---|---|
protected void | initApplicationContext() サブクラスは、カスタム初期化動作のためにこれをオーバーライドできます。 |
protected boolean | isEligibleForMarshalling(StringSE modelKey, ObjectSE value) 現在のビューのモデルからの指定された値が、構成された Marshaller によるマーシャリングに適格かどうかを確認します。 |
protected ObjectSE | locateToBeMarshalled(MapSE<StringSE, ObjectSE> model) マーシャリングするオブジェクトを見つけます。 |
protected void | renderMergedOutputModel(MapSE<StringSE, ObjectSE> model, HttpServletRequestEE request, HttpServletResponseEE response) ビューを実際にレンダリングするには、サブクラスでこのメソッドを実装する必要があります。 |
void | setMarshaller(Marshaller marshaller) このビューで使用する Marshaller を設定します。 |
void | setModelKey(StringSE modelKey) マーシャリングするオブジェクトを表すモデルキーの名前を設定します。 |
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, toString, writeToResponsegetServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContextgetApplicationContext, getMessageSourceAccessor, obtainApplicationContext, requiredContextClass, setApplicationContextcloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, waitSE, waitSE, waitSEpublic MarshallingView()
Marshaller が設定されていない新しい MarshallingView を構築します。マーシャラーは、構築後に setMarshaller(org.springframework.oxm.Marshaller) を呼び出して設定する必要があります。public MarshallingView(Marshaller marshaller)
Marshaller セットで新しい MarshallingView を構築します。public void setMarshaller(Marshaller marshaller)
Marshaller を設定します。public void setModelKey(StringSE modelKey)
protected void initApplicationContext()
ApplicationObjectSupport デフォルトの実装は空です。ApplicationObjectSupport.initApplicationContext(org.springframework.context.ApplicationContext) によって呼び出されます。
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 - レンダリングに失敗した場合 @Nullable protected ObjectSE locateToBeMarshalled(MapSE<StringSE,ObjectSE> model) throws IllegalStateExceptionSE
デフォルトの実装では、サポートされている型のオブジェクトの検索を試みる前に、構成されたモデルキーがある場合、最初にそのキーの下を調べます。
model - モデルマップ null )IllegalStateExceptionSE - モデルキーで指定されたモデルオブジェクトがマーシャラーでサポートされていない場合 setModelKey(String)protected boolean isEligibleForMarshalling(StringSE modelKey, ObjectSE value)
Marshaller によるマーシャリングに適格かどうかを確認します。 デフォルトの実装は Marshaller.supports(Class) を呼び出し、該当する場合は、指定された JAXBElementSE を最初にアンラップします。
modelKey - モデル内の値のキー (非 null)value - チェックする値 (非 null)Marshaller.supports(Class)