Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| The Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.web.portlet.context
Class PortletApplicationContextUtils

    java.lang.Object
      org.springframework.web.portlet.context.PortletApplicationContextUtils

    public abstract class PortletApplicationContextUtils

extends Object

Convenience methods for retrieving the root WebApplicationContext for a given PortletContext. This is e.g. useful for accessing a Spring context from within custom Portlet implementations.

Since:
  2.0
Author:
  Juergen Hoeller, John A. Lewis
See Also:
  `ContextLoader`, `WebApplicationContextUtils`, `FrameworkPortlet`, `DispatcherPortlet`

Constructor Summary
`PortletApplicationContextUtils()`

Method Summary
`static ApplicationContext` | `getRequiredWebApplicationContext(javax.portlet.PortletContext pc)` Find the root WebApplicationContext for this portlet application, which is typically loaded via ContextLoaderListener or ContextLoaderServlet.
`static ApplicationContext` | `getWebApplicationContext(javax.portlet.PortletContext pc)` Find the root WebApplicationContext for this portlet application, which is typically loaded via ContextLoaderListener or ContextLoaderServlet.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PortletApplicationContextUtils

    public PortletApplicationContextUtils()

Method Detail

### getWebApplicationContext

    public static ApplicationContext getWebApplicationContext(javax.portlet.PortletContext pc)

  Find the root WebApplicationContext for this portlet application, which is typically loaded via ContextLoaderListener or ContextLoaderServlet.

  Will rethrow an exception that happened on root context startup, to differentiate between a failed context startup and no context at all.

  Parameters:
    `pc` - PortletContext to find the web application context for
  Returns:
    the root WebApplicationContext for this web app, or `null` if none (typed to ApplicationContext to avoid a Servlet API dependency; can usually be casted to WebApplicationContext, but there shouldn't be a need to)
  See Also:
    `WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE`

### getRequiredWebApplicationContext

    public static ApplicationContext getRequiredWebApplicationContext(javax.portlet.PortletContext pc)
                                                               throws IllegalStateException

  Find the root WebApplicationContext for this portlet application, which is typically loaded via ContextLoaderListener or ContextLoaderServlet.

  Will rethrow an exception that happened on root context startup, to differentiate between a failed context startup and no context at all.

  Parameters:
    `pc` - PortletContext to find the web application context for
  Returns:
    the root WebApplicationContext for this web app (typed to ApplicationContext to avoid a Servlet API dependency; can usually be casted to WebApplicationContext, but there shouldn't be a need to)
  Throws:
    `IllegalStateException` - if the root WebApplicationContext could not be found
  See Also:
    `WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| The Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2008 The Spring Framework.