SourceForge.net Logo

de.mindmatters.faces.spring.config
Class ConfigWebApplicationContextUtils

java.lang.Object
  extended byde.mindmatters.faces.spring.config.ConfigWebApplicationContextUtils

public final class ConfigWebApplicationContextUtils
extends java.lang.Object

Convenience methods to retrieve the jsf-spring-config root ConfigWebApplicationContext 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:
ConfigWebApplicationContext

Method Summary
static ConfigWebApplicationContext getRequiredWebApplicationContext(FacesContext context)
          Find the required jsf-spring-config root ConfigWebApplicationContext for this web app, which is typically loaded via ContextLoaderListener.
static ConfigWebApplicationContext getRequiredWebApplicationContext(javax.servlet.ServletContext context)
          Find the required jsf-spring-config root ConfigWebApplicationContext for this web app, which is typically loaded via ContextLoaderListener.
static ConfigWebApplicationContext getWebApplicationContext(FacesContext context)
          Find the jsf-spring-config root ConfigWebApplicationContext for this web app, which is typically loaded via ConfigLoaderListener.
static ConfigWebApplicationContext getWebApplicationContext(javax.servlet.ServletContext context)
          Find the jsf-spring-config root ConfigWebApplicationContext for this web app, which is typically loaded via ConfigLoaderListener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getWebApplicationContext

public static ConfigWebApplicationContext getWebApplicationContext(FacesContext context)
Find the jsf-spring-config root ConfigWebApplicationContext for this web app, which is typically loaded via ConfigLoaderListener.

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 jsf-spring-config root ConfigWebApplicationContext for this web app, or null if none
See Also:
#ROOT_CONFIG_WEB_APPLICATION_CONTEXT_ATTRIBUTE

getWebApplicationContext

public static ConfigWebApplicationContext getWebApplicationContext(javax.servlet.ServletContext context)
Find the jsf-spring-config root ConfigWebApplicationContext for this web app, which is typically loaded via ConfigLoaderListener.

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 jsf-spring-config root ConfigWebApplicationContext for this web app, or null if none
See Also:
#ROOT_CONFIG_WEB_APPLICATION_CONTEXT_ATTRIBUTE

getRequiredWebApplicationContext

public static ConfigWebApplicationContext getRequiredWebApplicationContext(FacesContext context)
Find the required jsf-spring-config root ConfigWebApplicationContext 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 jsf-spring-config ConfigWebApplicationContext for this web app
Throws:
java.lang.IllegalStateException - if the jsf-spring-config ConfigWebApplicationContext could not be found
See Also:
#ROOT_CONFIG_WEB_APPLICATION_CONTEXT_ATTRIBUTE

getRequiredWebApplicationContext

public static ConfigWebApplicationContext getRequiredWebApplicationContext(javax.servlet.ServletContext context)
Find the required jsf-spring-config root ConfigWebApplicationContext 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 jsf-spring-config ConfigWebApplicationContext for this web app
Throws:
java.lang.IllegalStateException - if the jsf-spring-config ConfigWebApplicationContext could not be found
See Also:
#ROOT_CONFIG_WEB_APPLICATION_CONTEXT_ATTRIBUTE

SourceForge.net Logo

Copyright © 2002 mindmatters GmbH & Co. KG