|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jasig.portlet.calendar.spring.PortletApplicationContextLocator
public class PortletApplicationContextLocator
Provides standard access to the portal's ApplicationContext. If running in a web application a
WebApplicationContext is available.
#getApplicationContext() should be used by most uPortal code that needs access to the portal's
ApplicationContext. It ensures that a single ApplicationContext is used portal-wide both
when the portal is running as a web-application and when tools are run from the command line.
For legacy portal code that is not yet Spring managed and does not have access to the ServletContext this
class provides similar functionality to WebApplicationContextUtils via the
getWebApplicationContext() and getRequiredWebApplicationContext(). These methods are deprecated as
any code that requires a WebApplicationContext should either be refactored as a Spring managed bean or have
access to the ServletContext
| Constructor Summary | |
|---|---|
PortletApplicationContextLocator()
|
|
| Method Summary | |
|---|---|
void |
contextDestroyed(javax.servlet.ServletContextEvent sce)
|
void |
contextInitialized(javax.servlet.ServletContextEvent sce)
|
static org.springframework.context.ApplicationContext |
getApplicationContext(String importExportContextFile)
If running in a web application the existing WebApplicationContext will be returned. |
static org.springframework.web.context.WebApplicationContext |
getRequiredWebApplicationContext()
Deprecated. This method is a work-around for areas in uPortal that do not have the ability to use the WebApplicationContextUtils.getRequiredWebApplicationContext(ServletContext) directly. |
static org.springframework.web.context.WebApplicationContext |
getWebApplicationContext()
Deprecated. This method is a work-around for areas in uPortal that do not have the ability to use the WebApplicationContextUtils.getWebApplicationContext(ServletContext) directly. |
static boolean |
isRunningInWebApplication()
Deprecated. Only needed for using getRequiredWebApplicationContext() or getWebApplicationContext(). |
static void |
shutdown()
If the ApplicationContext returned by #getApplicationContext() is 'portal managed' the shutdown hook
for the context is called, closing and cleaning up all spring managed resources. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PortletApplicationContextLocator()
| Method Detail |
|---|
public void contextInitialized(javax.servlet.ServletContextEvent sce)
contextInitialized in interface javax.servlet.ServletContextListenerpublic void contextDestroyed(javax.servlet.ServletContextEvent sce)
contextDestroyed in interface javax.servlet.ServletContextListener@Deprecated public static boolean isRunningInWebApplication()
getRequiredWebApplicationContext() or getWebApplicationContext().
true if a WebApplicationContext is available, false if only an ApplicationContext is available@Deprecated public static org.springframework.web.context.WebApplicationContext getRequiredWebApplicationContext()
WebApplicationContextUtils.getRequiredWebApplicationContext(ServletContext) directly.
IllegalStateException - if no ServletContext is available to retrieve a WebApplicationContext for or if the root WebApplicationContext could not be found@Deprecated public static org.springframework.web.context.WebApplicationContext getWebApplicationContext()
WebApplicationContextUtils.getWebApplicationContext(ServletContext) directly.
public static org.springframework.context.ApplicationContext getApplicationContext(String importExportContextFile)
WebApplicationContext will be returned. if
not a singleton ApplicationContext is created if needed and returned. Unless a WebApplicationContext
is specifically needed this method should be used as it will work both when running in and out
of a web application
ApplicationContext for the portal.public static void shutdown()
#getApplicationContext() is 'portal managed' the shutdown hook
for the context is called, closing and cleaning up all spring managed resources.
If the ApplicationContext returned by #getApplicationContext() is actually a WebApplicationContext
this method does nothing but log an error message.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||