类 WebApplicationObjectSupport
- 所有已实现的接口:
cn.taketoday.beans.factory.Aware,cn.taketoday.context.ApplicationContextAware,ServletContextAware
WebApplicationContext.
Provides getWebApplicationContext(), getServletContext(), and
getTempDir() accessors.
Note: It is generally recommended to use individual callback interfaces for the actual
callbacks needed. This broad base class is primarily intended for use within the framework,
in case of ServletContext access etc typically being needed.
- 从以下版本开始:
- 2019-12-27 09:36
- 作者:
- Juergen Hoeller, TODAY
-
字段概要
字段从类继承的字段 cn.taketoday.context.support.ApplicationObjectSupport
applicationContext, log, messageSourceAccessor -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明protected final ServletContextReturn the current ServletContext.protected final FileReturn the temporary directory for the current web application, as provided by the servlet container.protected final WebApplicationContextReturn the current application context as WebApplicationContext.protected voidinitApplicationContext(cn.taketoday.context.ApplicationContext context) CallsinitServletContext(jakarta.servlet.ServletContext)if the given ApplicationContext is aWebApplicationContext.protected voidinitServletContext(ServletContext servletContext) Subclasses may override this for custom initialization based on the ServletContext that this application object runs in.protected booleanOverrides the base class behavior to enforce running in an ApplicationContext.final voidsetServletContext(ServletContext servletContext) Set theServletContextthat this object runs in.从类继承的方法 cn.taketoday.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, initApplicationContext, obtainApplicationContext, requiredContextClass, setApplicationContext, unwrapContext, unwrapFactory
-
字段详细资料
-
servletContext
-
-
构造器详细资料
-
WebApplicationObjectSupport
public WebApplicationObjectSupport()
-
-
方法详细资料
-
setServletContext
从接口复制的说明:ServletContextAwareSet theServletContextthat this object runs in.Invoked after population of normal bean properties but before an init callback like InitializingBean's
afterPropertiesSetor a custom init-method. Invoked after ApplicationContextAware'ssetApplicationContext.- 指定者:
setServletContext在接口中ServletContextAware- 参数:
servletContext- the ServletContext object to be used by this object- 另请参阅:
-
InitializingBean.afterPropertiesSet()ApplicationContextAware.setApplicationContext(cn.taketoday.context.ApplicationContext)
-
isContextRequired
protected boolean isContextRequired()Overrides the base class behavior to enforce running in an ApplicationContext. All accessors will throw IllegalStateException if not running in a context.- 覆盖:
isContextRequired在类中cn.taketoday.context.support.ApplicationObjectSupport- 另请参阅:
-
ApplicationObjectSupport.getApplicationContext()ApplicationObjectSupport.getMessageSourceAccessor()getWebApplicationContext()
-
initApplicationContext
protected void initApplicationContext(cn.taketoday.context.ApplicationContext context) CallsinitServletContext(jakarta.servlet.ServletContext)if the given ApplicationContext is aWebApplicationContext.- 覆盖:
initApplicationContext在类中cn.taketoday.context.support.ApplicationObjectSupport
-
initServletContext
Subclasses may override this for custom initialization based on the ServletContext that this application object runs in.The default implementation is empty. Called by
initApplicationContext(ApplicationContext)as well assetServletContext(jakarta.servlet.ServletContext).- 参数:
servletContext- the ServletContext that this application object runs in (nevernull)
-
getWebApplicationContext
@Nullable protected final WebApplicationContext getWebApplicationContext() throws IllegalStateExceptionReturn the current application context as WebApplicationContext.NOTE: Only use this if you actually need to access WebApplicationContext-specific functionality. Preferably use
getApplicationContext()orgetServletContext()else, to be able to run in non-WebApplicationContext environments as well.- 抛出:
IllegalStateException- if not running in a WebApplicationContext- 另请参阅:
-
ApplicationObjectSupport.getApplicationContext()
-
getServletContext
Return the current ServletContext.- 抛出:
IllegalStateException- if not running within a required ServletContext- 另请参阅:
-
getTempDir
Return the temporary directory for the current web application, as provided by the servlet container.- 返回:
- the File representing the temporary directory
- 抛出:
IllegalStateException- if not running within a ServletContext- 另请参阅:
-