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

## org.mortbay.jetty.servlet
Class ServletHolder

    java.lang.Object
      org.mortbay.component.AbstractLifeCycle
          org.mortbay.jetty.servlet.Holder
              org.mortbay.jetty.servlet.ServletHolder

All Implemented Interfaces:
  Serializable, Comparable, LifeCycle

    public class ServletHolder

extends Holder
implements Comparable

Servlet Instance and Context Holder. Holds the name, params and some state of a javax.servlet.Servlet instance. It implements the ServletConfig interface. This class will organise the loading of the servlet when needed or requested.

Author:
  Greg Wilkins
See Also:
  Serialized Form

Field Summary

Fields inherited from class org.mortbay.jetty.servlet.Holder
`_class, _className, _displayName, _extInstance, _initParams, _name, _servletHandler`

Constructor Summary
`ServletHolder()` Constructor .
`ServletHolder(Class servlet)` Constructor for existing servlet.
`ServletHolder(Servlet servlet)` Constructor for existing servlet.

Method Summary
`void` | `checkServletType()` Check to ensure class of servlet is acceptable.
`int` | `compareTo(Object o)` Comparitor by init order.
`void` | `destroyInstance(Object o)`
`void` | `doStart()`
`void` | `doStop()`
`boolean` | `equals(Object o)`
`String` | `getForcedPath()`
`int` | `getInitOrder()`
`Map` | `getRoleMap()`
`String` | `getRunAs()`
`Servlet` | `getServlet()` Get the servlet.
`String` | `getUserRoleLink(String name)` get a user role link.
`void` | `handle(ServletRequest request, ServletResponse response)` Service a request with this servlet.
`int` | `hashCode()`
`boolean` | `isAvailable()`
`void` | `setForcedPath(String forcedPath)`
`void` | `setInitOrder(int order)` Set the initialize order.
`void` | `setRunAs(String role)`
`void` | `setServlet(Servlet servlet)`
`void` | `setUserRoleLink(String name, String link)` Link a user role.

Methods inherited from class org.mortbay.jetty.servlet.Holder
`getClassName, getDisplayName, getHeldClass, getInitParameter, getInitParameterNames, getInitParameters, getName, getServletHandler, newInstance, setClassName, setDisplayName, setHeldClass, setInitParameter, setInitParameters, setName, setServletHandler, toString`

Methods inherited from class org.mortbay.component.AbstractLifeCycle
`isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, start, stop`

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

Constructor Detail

### ServletHolder

    public ServletHolder()

  Constructor .

### ServletHolder

    public ServletHolder(Servlet servlet)

  Constructor for existing servlet.

### ServletHolder

    public ServletHolder(Class servlet)

  Constructor for existing servlet.

Method Detail

### setServlet

    public void setServlet(Servlet servlet)

### getInitOrder

    public int getInitOrder()

### setInitOrder

    public void setInitOrder(int order)

  Set the initialize order. Holders with order<0, are initialized on use. Those with order>=0 are initialized in increasing order when the handler is started.

### compareTo

    public int compareTo(Object o)

  Comparitor by init order.

  Specified by:
    `compareTo` in interface `Comparable`

### equals

    public boolean equals(Object o)

  Overrides:
    `equals` in class `Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### setUserRoleLink

    public void setUserRoleLink(String name,
                                String link)

  Link a user role. Translate the role name used by a servlet, to the link name used by the container.

  Parameters:
    `name` - The role name as used by the servlet
    `link` - The role name as used by the container.

### getUserRoleLink

    public String getUserRoleLink(String name)

  get a user role link.

  Parameters:
    `name` - The name of the role
  Returns:
    The name as translated by the link. If no link exists, the name is returned.

### getRoleMap

    public Map getRoleMap()

### setRunAs

    public void setRunAs(String role)

  Parameters:
    `role` - Role name that is added to UserPrincipal when this servlet is called.

### getRunAs

    public String getRunAs()

### getForcedPath

    public String getForcedPath()

  Returns:
    Returns the forcedPath.

### setForcedPath

    public void setForcedPath(String forcedPath)

  Parameters:
    `forcedPath` - The forcedPath to set.

### doStart

    public void doStart()
                 throws Exception

  Overrides:
    `doStart` in class `Holder`
  Throws:
    `Exception`

### doStop

    public void doStop()

  Overrides:
    `doStop` in class `Holder`

### destroyInstance

    public void destroyInstance(Object o)
                         throws Exception

  Overrides:
    `destroyInstance` in class `Holder`
  Throws:
    `Exception`

### getServlet

    public Servlet getServlet()
                       throws ServletException

  Get the servlet.

  Returns:
    The servlet
  Throws:
    `ServletException`

### checkServletType

    public void checkServletType()
                          throws UnavailableException

  Check to ensure class of servlet is acceptable.

  Throws:
    `UnavailableException`

### isAvailable

    public boolean isAvailable()

  Returns:
    true if the holder is started and is not unavailable

### handle

    public void handle(ServletRequest request,
                       ServletResponse response)
                throws ServletException,
                       UnavailableException,
                       IOException

  Service a request with this servlet.

  Throws:
    `ServletException`
    `UnavailableException`
    `IOException`

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

Copyright © 2007 Mort Bay Consulting. All Rights Reserved.