org.codehaus.plexus.servlet
Class PlexusServletUtils

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

public final class PlexusServletUtils
extends java.lang.Object

A collection of static helper methods for code running within a Servlet environment that needs to access an embedded Plexus container. Such code can either extend PlexusServlet or invoke these static methods directly.

Version:
$Revision: 2572 $
Author:
Mark Wilkinson

Method Summary
static org.codehaus.plexus.PlexusContainer getPlexusContainer(javax.servlet.ServletContext sc)
          Get a reference to the Plexus container loaded into the ServletContext, if one exists.
static boolean hasComponent(javax.servlet.ServletContext sc, java.lang.String role)
           
static boolean hasComponent(javax.servlet.ServletContext sc, java.lang.String role, java.lang.String id)
           
static java.lang.Object lookup(javax.servlet.ServletContext sc, java.lang.String role)
           
static java.lang.Object lookup(javax.servlet.ServletContext sc, java.lang.String role, java.lang.String id)
           
static void release(javax.servlet.ServletContext sc, java.lang.Object service)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getPlexusContainer

public static org.codehaus.plexus.PlexusContainer getPlexusContainer(javax.servlet.ServletContext sc)
Get a reference to the Plexus container loaded into the ServletContext, if one exists.

Parameters:
sc - The servlet context that Plexus is installed in.
Returns:
a PlexusContainer object, or null if none was registered in the servlet context.

hasComponent

public static boolean hasComponent(javax.servlet.ServletContext sc,
                                   java.lang.String role)

hasComponent

public static boolean hasComponent(javax.servlet.ServletContext sc,
                                   java.lang.String role,
                                   java.lang.String id)

lookup

public static java.lang.Object lookup(javax.servlet.ServletContext sc,
                                      java.lang.String role)
                               throws javax.servlet.ServletException
Throws:
javax.servlet.ServletException

lookup

public static java.lang.Object lookup(javax.servlet.ServletContext sc,
                                      java.lang.String role,
                                      java.lang.String id)
                               throws javax.servlet.ServletException
Throws:
javax.servlet.ServletException

release

public static void release(javax.servlet.ServletContext sc,
                           java.lang.Object service)
                    throws javax.servlet.ServletException
Throws:
javax.servlet.ServletException


Copyright © 2001-2007 Codehaus. All Rights Reserved.