public class TilesConfigurer extends ObjectSE implements ServletContextAware, InitializingBean, DisposableBean
TilesConfigurer は、TilesView
インスタンスによってアクセスされる定義を含む一連のファイルを使用して TilesContainer を構成するだけです。これは、Tiles が提供する ServletContextListener
(web.xml
で使用するための CompleteAutoloadTilesListener
など)の Spring ベースの代替(Spring 構成で使用するため)です。
TilesViews は、どの ViewResolver
でも管理できます。単純な規則に基づくビューリゾルバーについては、TilesViewResolver
の使用を検討してください。
典型的な TilesConfigurer Bean 定義は次のようになります。
<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles3.TilesConfigurer"> <property name="definitions"> <list> <value>/WEB-INF/defs/general.xml</value> <value>/WEB-INF/defs/widgets.xml</value> <value>/WEB-INF/defs/administrator.xml</value> <value>/WEB-INF/defs/customer.xml</value> <value>/WEB-INF/defs/templates.xml</value> </list> </property> </bean>リストの値は、定義を含む実際の Tiles XML ファイルです。リストが指定されていない場合、デフォルトは
"/WEB-INF/tiles.xml"
です。Tiles 3 では、Tiles 定義を含むファイル名の下線がロケール情報を示すために使用されていることに注意してください。例:
<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles3.TilesConfigurer"> <property name="definitions"> <list> <value>/WEB-INF/defs/tiles.xml</value> <value>/WEB-INF/defs/tiles_fr_FR.xml</value> </list> </property> </bean>
TilesView
, TilesViewResolver
コンストラクターと説明 |
---|
TilesConfigurer() |
修飾子と型 | メソッドと説明 |
---|---|
void | afterPropertiesSet() この Web アプリケーションの TilesContainer を作成して公開し、TilesInitializer に委譲します。 |
void | destroy() この Web アプリケーションから TilesContainer を削除します。 |
void | setCheckRefresh(boolean checkRefresh) 実行時にリフレッシュするために Tiles 定義ファイルをチェックするかどうかを設定します。 |
void | setCompleteAutoload(boolean completeAutoload) Tiles 3.0 の "complete-autoload" 構成を適用するかどうかを指定します。 |
void | setDefinitions(StringSE... definitions) Tiles 定義を設定します。 |
void | setDefinitionsFactoryClass(ClassSE<? extends DefinitionsFactory> definitionsFactoryClass) 使用する DefinitionsFactory 実装を設定します。 |
void | setPreparerFactoryClass(ClassSE<? extends PreparerFactory> preparerFactoryClass) 使用する PreparerFactory 実装を設定します。 |
void | setServletContext(ServletContextEE servletContext) このオブジェクトが実行される ServletContext EE を設定します。 |
void | setTilesInitializer(TilesInitializer tilesInitializer) 通常は内部 Bean として指定されるカスタム TilesInitializer を使用して Tiles を構成します。 |
void | setUseMutableTilesContainer(boolean useMutableTilesContainer) このアプリケーションに MutableTilesContainer(通常は CachingTilesContainer 実装)を使用するかどうかを設定します。 |
void | setValidateDefinitions(boolean validateDefinitions) Tiles XML 定義を検証するかどうかを設定します。 |
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSE
protected final Log logger
public void setTilesInitializer(TilesInitializer tilesInitializer)
デフォルトは、このコンフィギュレータの「定義」、"preparerFactoryClass" などのプロパティを考慮した DefaultTilesInitializer
のバリアントです。
注: カスタム TilesInitializer を指定すると、この構成プログラムの他のすべての Bean プロパティが事実上無効になります。その後、初期化手順全体が指定された TilesInitializer に任されます。
public void setCompleteAutoload(boolean completeAutoload)
完全自動ロードモードの詳細については、CompleteAutoloadTilesContainerFactory
を参照してください。
注: 完全自動ロードモードを指定すると、この構成プログラムの他のすべての Bean プロパティが事実上無効になります。その後、初期化手順全体は CompleteAutoloadTilesInitializer
に任されます。
public void setDefinitions(StringSE... definitions)
public void setCheckRefresh(boolean checkRefresh)
public void setValidateDefinitions(boolean validateDefinitions)
public void setDefinitionsFactoryClass(ClassSE<? extends DefinitionsFactory> definitionsFactoryClass)
DefinitionsFactory
実装を設定します。デフォルトは UnresolvingLocaleDefinitionsFactory
で、定義リソースの URL で動作します。 カスタム DefinitionsFactory を指定します。UrlDefinitionsFactory サブクラス。Tiles 定義オブジェクトの作成をカスタマイズします。別の TilesContainerFactory を構成しない限り、そのような DefinitionsFactory は URL
SE ソースオブジェクトを処理できる必要があることに注意してください。
public void setPreparerFactoryClass(ClassSE<? extends PreparerFactory> preparerFactoryClass)
PreparerFactory
実装を設定します。デフォルトは BasicPreparerFactory
で、指定した準備クラスの共有インスタンスを作成します。SimpleSpringPreparerFactory
を指定して、指定された準備クラスに基づいて ViewPreparer
インスタンスをオートワイヤーし、Spring のコンテナーコールバックを適用し、構成された Spring BeanPostProcessors を適用します。Spring のコンテキスト全体のアノテーション設定がアクティブ化されている場合、ViewPreparer クラスのアノテーションが自動的に検出され、適用されます。
SpringBeanPreparerFactory
を指定して、クラスの代わりに指定された作成者名を操作し、DispatcherServlet のアプリケーションコンテキストから対応する Spring Bean を取得します。この場合、完全な Bean 作成プロセスは Spring アプリケーションコンテキストの制御下にあり、スコープ付き Bean などを使用できます。(Tiles 定義で使用されるように)準備名ごとに 1 つの Spring Bean 定義を定義する必要があることに注意してください。
public void setUseMutableTilesContainer(boolean useMutableTilesContainer)
public void setServletContext(ServletContextEE servletContext)
ServletContextAware
ServletContext
EE を設定します。 通常の Bean プロパティの設定後、InitializingBean の afterPropertiesSet
またはカスタム init メソッドのような初期コールバックの前に呼び出されます。ApplicationContextAware の setApplicationContext
の後に呼び出されます。
ServletContextAware
の setServletContext
servletContext
- このオブジェクトによって使用される ServletContext オブジェクト InitializingBean.afterPropertiesSet()
, ApplicationContextAware.setApplicationContext(org.springframework.context.ApplicationContext)
public void afterPropertiesSet() throws TilesException
InitializingBean
の afterPropertiesSet
TilesException
- セットアップが失敗した場合 public void destroy() throws TilesException
DisposableBean
の destroy
TilesException
- クリーンアップに失敗した場合