public abstract class WebApplicationObjectSupport extends ApplicationObjectSupport implements ServletContextAware
WebApplicationContext
で実行されるアプリケーションオブジェクト用の便利なスーパークラス。getWebApplicationContext()
、getServletContext()
、getTempDir()
アクセサーを提供します。 メモ: 通常、必要な実際のコールバックには個別のコールバックインターフェースを使用することをお勧めします。この広範な基本クラスは、主に ServletContext
EE アクセスなどが必要な場合に、主にフレームワーク内で使用することを目的としています。
SpringBeanAutowiringSupport
logger
コンストラクターと説明 |
---|
WebApplicationObjectSupport() |
修飾子と型 | メソッドと説明 |
---|---|
protected ServletContextEE | getServletContext() 現在の ServletContext を返します。 |
protected FileSE | getTempDir() サーブレットコンテナーによって提供される、現在の Web アプリケーションの一時ディレクトリを返します。 |
protected WebApplicationContext | getWebApplicationContext() 現在のアプリケーションコンテキストを WebApplicationContext として返します。 |
protected void | initApplicationContext(ApplicationContext context) 指定された ApplicationContext が WebApplicationContext の場合、initServletContext(javax.servlet.ServletContext) を呼び出します。 |
protected void | initServletContext(ServletContextEE servletContext) サブクラスは、このアプリケーションオブジェクトが実行される ServletContext に基づいて、カスタム初期化のためにこれをオーバーライドできます。 |
protected boolean | isContextRequired() 基本クラスの動作をオーバーライドして、ApplicationContext での実行を強制します。 |
void | setServletContext(ServletContextEE servletContext) このオブジェクトが実行される ServletContext EE を設定します。 |
getApplicationContext, getMessageSourceAccessor, initApplicationContext, obtainApplicationContext, requiredContextClass, setApplicationContext
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSE
public final 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)
protected boolean isContextRequired()
protected void initApplicationContext(ApplicationContext context)
WebApplicationContext
の場合、initServletContext(javax.servlet.ServletContext)
を呼び出します。ApplicationObjectSupport
の initApplicationContext
context
- 含む ApplicationContextApplicationObjectSupport.setApplicationContext(org.springframework.context.ApplicationContext)
protected void initServletContext(ServletContextEE servletContext)
デフォルトの実装は空です。initApplicationContext(org.springframework.context.ApplicationContext)
および setServletContext(javax.servlet.ServletContext)
によって呼び出されます。
servletContext
- このアプリケーションオブジェクトが実行される ServletContext (非 null
)@Nullable protected final WebApplicationContext getWebApplicationContext() throws IllegalStateExceptionSE
注意 : これは、実際に WebApplicationContext 固有の機能にアクセスする必要がある場合にのみ使用してください。非 WebApplicationContext 環境でも実行できるようにするには、getApplicationContext()
または getServletContext()
を使用することをお勧めします。
IllegalStateExceptionSE
- WebApplicationContext で実行されていない場合 ApplicationObjectSupport.getApplicationContext()
@Nullable protected final ServletContextEE getServletContext() throws IllegalStateExceptionSE
IllegalStateExceptionSE
- 必要な ServletContext 内で実行されていない場合 isContextRequired()
protected final FileSE getTempDir() throws IllegalStateExceptionSE
IllegalStateExceptionSE
- ServletContext 内で実行されていない場合 WebUtils.getTempDir(javax.servlet.ServletContext)