SourceForge.net Logo

de.mindmatters.faces.spring.context
Class FacesWebApplicationContextUtils

java.lang.Object
  extended byde.mindmatters.faces.spring.context.FacesWebApplicationContextUtils

public final class FacesWebApplicationContextUtils
extends java.lang.Object

Convenience methods to retrieve the faces root FacesWebApplicationContext for a given ServletContext or FacesContext. This is e.g. useful for accessing a faces-spring context from within custom components.

Author:
Andreas Kuhrwahl
See Also:
FacesWebApplicationContext

Method Summary
static FacesWebApplicationContext getRequiredWebApplicationContext(FacesContext context)
          Finds the required faces root FacesWebApplicationContext for this web app, which is typically loaded via ContextLoaderListenr.
static FacesWebApplicationContext getRequiredWebApplicationContext(javax.servlet.ServletContext context)
          Finds the required faces root FacesWebApplicationContext for this web app, which is typically loaded via ContextLoaderListenr.
static FacesWebApplicationContext getWebApplicationContext(FacesContext context)
          Finds the faces root FacesWebApplicationContext for this web app, which is typically loaded via ContextLoaderListener.
static FacesWebApplicationContext getWebApplicationContext(javax.servlet.ServletContext context)
          Finds the faces root FacesWebApplicationContext for this web app, which is typically loaded via ContextLoaderListener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getWebApplicationContext

public static FacesWebApplicationContext getWebApplicationContext(FacesContext context)
Finds the faces root FacesWebApplicationContext for this web app, which is typically loaded via ContextLoaderListener.

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

Parameters:
context - FacesContext to find the web application context for
Returns:
the faces root FacesWebApplicationContext for this web app, or null if none
See Also:
FacesWebApplicationContext.ROOT_FACES_WEB_APPLICATION_CONTEXT_ATTRIBUTE

getWebApplicationContext

public static FacesWebApplicationContext getWebApplicationContext(javax.servlet.ServletContext context)
Finds the faces root FacesWebApplicationContext for this web app, which is typically loaded via ContextLoaderListener.

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

Parameters:
context - ServletContext to find the web application context for
Returns:
the faces root FacesWebApplicationContext for this web app, or null if none
See Also:
FacesWebApplicationContext.ROOT_FACES_WEB_APPLICATION_CONTEXT_ATTRIBUTE

getRequiredWebApplicationContext

public static FacesWebApplicationContext getRequiredWebApplicationContext(FacesContext context)
Finds the required faces root FacesWebApplicationContext for this web app, which is typically loaded via ContextLoaderListenr.

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

Parameters:
context - FacesContext to find the web application context for
Returns:
the root WebApplicationContext for this web app
Throws:
java.lang.IllegalStateException - if the root FacesWebApplicationContext could not be found
See Also:
FacesWebApplicationContext.ROOT_FACES_WEB_APPLICATION_CONTEXT_ATTRIBUTE

getRequiredWebApplicationContext

public static FacesWebApplicationContext getRequiredWebApplicationContext(javax.servlet.ServletContext context)
Finds the required faces root FacesWebApplicationContext for this web app, which is typically loaded via ContextLoaderListenr.

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

Parameters:
context - ServletContext to find the web application context for
Returns:
the root WebApplicationContext for this web app
Throws:
java.lang.IllegalStateException - if the root FacesWebApplicationContext could not be found
See Also:
FacesWebApplicationContext.ROOT_FACES_WEB_APPLICATION_CONTEXT_ATTRIBUTE

SourceForge.net Logo

Copyright © 2002 mindmatters GmbH & Co. KG