org.codehaus.plexus.servlet
Class ServletContextUtils

java.lang.Object
  extended byorg.codehaus.plexus.servlet.ServletContextUtils

final class ServletContextUtils
extends java.lang.Object

ServletContextUtils provides methods to embed a Plexus container within a Servlet context.

Version:
$Id: ServletContextUtils.java 2572 2005-09-29 15:51:08Z trygvis $
Author:
Mark Wilkinson

Field Summary
private static java.lang.String DEFAULT_PLEXUS_CONFIG
           
private static java.lang.String DEFAULT_PLEXUS_PROPERTIES
           
(package private) static java.lang.String PLEXUS_CONFIG_PARAM
           
private static java.lang.String PLEXUS_HOME
           
private static java.lang.String PLEXUS_PROPERTIES_PARAM
           
 
Constructor Summary
private ServletContextUtils()
           
 
Method Summary
(package private) static org.codehaus.plexus.embed.Embedder createContainer(javax.servlet.ServletContext context, java.lang.String plexusConf)
          Create a Plexus container using the Embedder.
(package private) static void destroyContainer(org.codehaus.plexus.embed.Embedder embedder, javax.servlet.ServletContext context)
           
private static java.lang.String resolveConfig(javax.servlet.ServletContext context, java.lang.String plexusConf)
           
private static java.util.Properties resolveContextProperties(javax.servlet.ServletContext context)
           
private static void setPlexusHome(javax.servlet.ServletContext context, java.util.Properties contexProperties)
          Set plexus.home context variable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PLEXUS_HOME

private static final java.lang.String PLEXUS_HOME
See Also:
Constant Field Values

PLEXUS_CONFIG_PARAM

static final java.lang.String PLEXUS_CONFIG_PARAM
See Also:
Constant Field Values

PLEXUS_PROPERTIES_PARAM

private static final java.lang.String PLEXUS_PROPERTIES_PARAM
See Also:
Constant Field Values

DEFAULT_PLEXUS_CONFIG

private static final java.lang.String DEFAULT_PLEXUS_CONFIG
See Also:
Constant Field Values

DEFAULT_PLEXUS_PROPERTIES

private static final java.lang.String DEFAULT_PLEXUS_PROPERTIES
See Also:
Constant Field Values
Constructor Detail

ServletContextUtils

private ServletContextUtils()
Method Detail

resolveConfig

private static java.lang.String resolveConfig(javax.servlet.ServletContext context,
                                              java.lang.String plexusConf)

resolveContextProperties

private static java.util.Properties resolveContextProperties(javax.servlet.ServletContext context)

setPlexusHome

private static void setPlexusHome(javax.servlet.ServletContext context,
                                  java.util.Properties contexProperties)
Set plexus.home context variable


createContainer

static org.codehaus.plexus.embed.Embedder createContainer(javax.servlet.ServletContext context,
                                                          java.lang.String plexusConf)
                                                   throws java.io.IOException,
                                                          org.codehaus.plexus.PlexusContainerException
Create a Plexus container using the Embedder. This method should be called from an environment where a ServletContext is available. It will create and initialize the Plexus container and place references to the container into the context.

Parameters:
context - The servlet context to place the container in.
plexusConf - Name of the Plexus configuration file to load, or null to fall back to the default behaviour.
Returns:
a Plexus container that has been initialized and started.
Throws:
java.lang.RuntimeException - If the Plexus container could not be started.
java.io.IOException
org.codehaus.plexus.PlexusContainerException

destroyContainer

static void destroyContainer(org.codehaus.plexus.embed.Embedder embedder,
                             javax.servlet.ServletContext context)