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.eclipse.jetty.servlet
Class ServletHolder

    java.lang.Object
      org.eclipse.jetty.util.component.AbstractLifeCycle
          org.eclipse.jetty.servlet.Holder<Servlet>
              org.eclipse.jetty.servlet.ServletHolder

All Implemented Interfaces:
  java.lang.Comparable, UserIdentity.Scope, LifeCycle

    public class ServletHolder

extends Holder<Servlet>
implements UserIdentity.Scope, java.lang.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.

Nested Class Summary
`protected class` | `ServletHolder.Config`
`class` | `ServletHolder.Registration`

Nested classes/interfaces inherited from class org.eclipse.jetty.servlet.Holder
`Holder.HolderConfig, Holder.HolderRegistration, Holder.Source`

Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
`AbstractLifeCycle.AbstractLifeCycleListener`

Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
`LifeCycle.Listener`

Field Summary
`static java.util.Map<java.lang.String,java.lang.String>` | `NO_MAPPED_ROLES`

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

Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
`_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING`

Constructor Summary
`ServletHolder()` Constructor .
`ServletHolder(java.lang.Class<? extends Servlet> servlet)` Constructor for existing servlet.
`ServletHolder(Holder.Source creator)` Constructor .
`ServletHolder(Servlet servlet)` Constructor for existing servlet.

Method Summary
`void` | `checkServletType()` Check to ensure class of servlet is acceptable.
`int` | `compareTo(java.lang.Object o)` Comparitor by init order.
`void` | `destroyInstance(java.lang.Object o)`
`void` | `doStart()`
`void` | `doStop()`
`boolean` | `equals(java.lang.Object o)`
`java.lang.String` | `getContextPath()`
`java.lang.String` | `getForcedPath()`
`int` | `getInitOrder()`
`ServletRegistration.Dynamic` | `getRegistration()`
`java.util.Map<java.lang.String,java.lang.String>` | `getRoleMap()`
`java.util.Map<java.lang.String,java.lang.String>` | `getRoleRefMap()`
`java.lang.String` | `getRunAsRole()`
`Servlet` | `getServlet()` Get the servlet.
`Servlet` | `getServletInstance()` Get the servlet instance (no initialization done).
`UnavailableException` | `getUnavailableException()`
`java.lang.String` | `getUserRoleLink(java.lang.String name)` get a user role link.
`void` | `handle(Request baseRequest, ServletRequest request, ServletResponse response)` Service a request with this servlet.
`int` | `hashCode()`
`boolean` | `isAvailable()`
`boolean` | `isSetInitOrder()`
`protected Servlet` | `newInstance()`
`void` | `setForcedPath(java.lang.String forcedPath)`
`void` | `setInitOrder(int order)` Set the initialize order.
`void` | `setRunAsRole(java.lang.String role)`
`void` | `setServlet(Servlet servlet)`
`void` | `setUserRoleLink(java.lang.String name, java.lang.String link)` Link a user role.

Methods inherited from class org.eclipse.jetty.servlet.Holder
`getClassName, getDisplayName, getHeldClass, getInitParameter, getInitParameterNames, getInitParameters, getName, getServletHandler, getSource, illegalStateIfContextStarted, isAsyncSupported, isInstance, setAsyncSupported, setClassName, setDisplayName, setHeldClass, setInitParameter, setInitParameters, setName, setServletHandler, toString`

Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
`addLifeCycleListener, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop`

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

Methods inherited from interface org.eclipse.jetty.server.UserIdentity.Scope
`getName`

Field Detail

### NO_MAPPED_ROLES

    public static final java.util.Map<java.lang.String,java.lang.String> NO_MAPPED_ROLES

Constructor Detail

### ServletHolder

    public ServletHolder()

  Constructor .

### ServletHolder

    public ServletHolder(Holder.Source creator)

  Constructor .

### ServletHolder

    public ServletHolder(Servlet servlet)

  Constructor for existing servlet.

### ServletHolder

    public ServletHolder(java.lang.Class<? extends Servlet> servlet)

  Constructor for existing servlet.

Method Detail

### getUnavailableException

    public UnavailableException getUnavailableException()

  Returns:
    The unavailable exception or null if not unavailable

### 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.

### isSetInitOrder

    public boolean isSetInitOrder()

### compareTo

    public int compareTo(java.lang.Object o)

  Comparitor by init order.

  Specified by:
    `compareTo` in interface `java.lang.Comparable`

### equals

    public boolean equals(java.lang.Object o)

  Overrides:
    `equals` in class `java.lang.Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `java.lang.Object`

### setUserRoleLink

    public void setUserRoleLink(java.lang.String name,
                                java.lang.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 java.lang.String getUserRoleLink(java.lang.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 java.util.Map<java.lang.String,java.lang.String> getRoleMap()

### getForcedPath

    public java.lang.String getForcedPath()

  Returns:
    Returns the forcedPath.

### setForcedPath

    public void setForcedPath(java.lang.String forcedPath)

  Parameters:
    `forcedPath` - The forcedPath to set.

### doStart

    public void doStart()
                 throws java.lang.Exception

  Overrides:
    `doStart` in class `Holder<Servlet>`
  Throws:
    `java.lang.Exception`

### doStop

    public void doStop()
                throws java.lang.Exception

  Overrides:
    `doStop` in class `Holder<Servlet>`
  Throws:
    `java.lang.Exception`

### destroyInstance

    public void destroyInstance(java.lang.Object o)
                         throws java.lang.Exception

  Overrides:
    `destroyInstance` in class `Holder<Servlet>`
  Throws:
    `java.lang.Exception`

### getServlet

    public Servlet getServlet()
                       throws ServletException

  Get the servlet.

  Returns:
    The servlet
  Throws:
    `ServletException`

### getServletInstance

    public Servlet getServletInstance()

  Get the servlet instance (no initialization done).

  Returns:
    The servlet or null

### 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

### getContextPath

    public java.lang.String getContextPath()

  Specified by:
    `getContextPath` in interface `UserIdentity.Scope`
  Returns:
    The context path that the identity is being considered within
  See Also:
    `UserIdentity.Scope.getContextPath()`

### getRoleRefMap

    public java.util.Map<java.lang.String,java.lang.String> getRoleRefMap()

  Specified by:
    `getRoleRefMap` in interface `UserIdentity.Scope`
  Returns:
    A map of role reference names that converts from names used by application code to names used by the context deployment.
  See Also:
    `UserIdentity.Scope.getRoleRefMap()`

### getRunAsRole

    public java.lang.String getRunAsRole()

### setRunAsRole

    public void setRunAsRole(java.lang.String role)

### handle

    public void handle(Request baseRequest,
                       ServletRequest request,
                       ServletResponse response)
                throws ServletException,
                       UnavailableException,
                       java.io.IOException

  Service a request with this servlet.

  Throws:
    `ServletException`
    `UnavailableException`
    `java.io.IOException`

### getRegistration

    public ServletRegistration.Dynamic getRegistration()

### newInstance

    protected Servlet newInstance()
                           throws ServletException,
                                  java.lang.IllegalAccessException,
                                  java.lang.InstantiationException

  Returns:
  Throws:
    `ServletException`
    `java.lang.IllegalAccessException`
    `java.lang.InstantiationException`

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 © 1995-2010 Mort Bay Consulting. All Rights Reserved.