java.lang.Comparable<ServletHolder>, org.eclipse.jetty.server.UserIdentity.Scope@ManagedObject("Servlet Holder")
public class ServletHolder
extends Holder<javax.servlet.Servlet>
implements org.eclipse.jetty.server.UserIdentity.Scope, java.lang.Comparable<ServletHolder>
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.
| Modifier and Type | Class | Description |
|---|---|---|
protected class |
ServletHolder.Config |
|
static class |
ServletHolder.JspContainer |
|
class |
ServletHolder.Registration |
org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListenerBaseHolder.SourceHolder.HolderConfig, Holder.HolderRegistration| Modifier and Type | Field | Description |
|---|---|---|
static java.lang.String |
APACHE_SENTINEL_CLASS |
|
static java.lang.String |
JSP_GENERATED_PACKAGE_NAME |
|
static java.util.Map<java.lang.String,java.lang.String> |
NO_MAPPED_ROLES |
FAILED, RUNNING, STARTED, STARTING, STOP_ON_FAILURE, STOPPED, STOPPING_class, _className, _extInstance, _servletHandler, _source_asyncSupported, _displayName, _initialized, _initParams, _name| Constructor | Description |
|---|---|
ServletHolder() |
Constructor .
|
ServletHolder(java.lang.Class<? extends javax.servlet.Servlet> servlet) |
Constructor for servlet class.
|
ServletHolder(java.lang.String name,
java.lang.Class<? extends javax.servlet.Servlet> servlet) |
Constructor for servlet class.
|
ServletHolder(java.lang.String name,
javax.servlet.Servlet servlet) |
Constructor for servlet class.
|
ServletHolder(javax.servlet.Servlet servlet) |
Constructor for existing servlet.
|
ServletHolder(BaseHolder.Source creator) |
Constructor .
|
| Modifier and Type | Method | Description |
|---|---|---|
protected void |
appendPath(java.lang.StringBuffer path,
java.lang.String element) |
Concatenate an element on to fully qualified classname.
|
void |
checkServletType() |
Check to ensure class of servlet is acceptable.
|
int |
compareTo(ServletHolder sh) |
Comparator by init order.
|
void |
destroyInstance(java.lang.Object o) |
|
void |
doStart() |
|
void |
doStop() |
|
javax.servlet.Servlet |
ensureInstance() |
|
boolean |
equals(java.lang.Object o) |
|
java.lang.String |
getClassNameForJsp(java.lang.String jsp) |
|
java.lang.String |
getContextPath() |
|
java.lang.String |
getForcedPath() |
|
int |
getInitOrder() |
|
java.lang.String |
getJspPackagePrefix() |
|
java.lang.String |
getNameOfJspClass(java.lang.String jsp) |
|
java.lang.String |
getPackageOfJspClass(java.lang.String jsp) |
|
javax.servlet.ServletRegistration.Dynamic |
getRegistration() |
|
java.util.Map<java.lang.String,java.lang.String> |
getRoleRefMap() |
|
java.lang.String |
getRunAsRole() |
|
javax.servlet.Servlet |
getServlet() |
Get the servlet.
|
javax.servlet.Servlet |
getServletInstance() |
Get the servlet instance (no initialization done).
|
javax.servlet.UnavailableException |
getUnavailableException() |
|
java.lang.String |
getUserRoleLink(java.lang.String name) |
get a user role link.
|
void |
handle(org.eclipse.jetty.server.Request baseRequest,
javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response) |
Service a request with this servlet.
|
int |
hashCode() |
|
void |
initialize() |
Do any setup necessary after starting
|
protected void |
initJspServlet() |
|
protected void |
initMultiPart() |
Register a ServletRequestListener that will ensure tmp multipart
files are deleted when the request goes out of scope.
|
boolean |
isAvailable() |
|
boolean |
isEnabled() |
|
protected javax.servlet.Servlet |
newInstance() |
|
protected void |
prepare(org.eclipse.jetty.server.Request baseRequest,
javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response) |
Prepare to service a request.
|
void |
setEnabled(boolean enabled) |
|
void |
setForcedPath(java.lang.String forcedPath) |
|
void |
setInitOrder(int order) |
Set the initialize order.
|
void |
setRunAsRole(java.lang.String role) |
|
void |
setServlet(javax.servlet.Servlet servlet) |
|
void |
setUserRoleLink(java.lang.String name,
java.lang.String link) |
Link a user role.
|
java.lang.String |
toString() |
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, setStopTimeout, start, stopgetClassName, getHeldClass, getServletHandler, getSource, illegalStateIfContextStarted, isInstance, setServletHandlerdump, dump, getDisplayName, getInitParameter, getInitParameterNames, getInitParameters, getName, isAsyncSupported, setAsyncSupported, setClassName, setDisplayName, setHeldClass, setInitParameter, setInitParameters, setNamepublic static final java.lang.String APACHE_SENTINEL_CLASS
public static final java.lang.String JSP_GENERATED_PACKAGE_NAME
public static final java.util.Map<java.lang.String,java.lang.String> NO_MAPPED_ROLES
public ServletHolder()
public ServletHolder(BaseHolder.Source creator)
creator - the holder sourcepublic ServletHolder(javax.servlet.Servlet servlet)
servlet - the servletpublic ServletHolder(java.lang.String name,
java.lang.Class<? extends javax.servlet.Servlet> servlet)
name - the name of the servletservlet - the servlet classpublic ServletHolder(java.lang.String name,
javax.servlet.Servlet servlet)
name - the servlet nameservlet - the servletpublic ServletHolder(java.lang.Class<? extends javax.servlet.Servlet> servlet)
servlet - the servlet classpublic javax.servlet.UnavailableException getUnavailableException()
public void setServlet(javax.servlet.Servlet servlet)
@ManagedAttribute(value="initialization order",
readonly=true)
public int getInitOrder()
public void setInitOrder(int order)
Holders with order<0, are initialized on use. Those with order>=0 are initialized in increasing order when the handler is started.
order - the servlet init orderpublic int compareTo(ServletHolder sh)
compareTo in interface java.lang.Comparable<ServletHolder>public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic void setUserRoleLink(java.lang.String name,
java.lang.String link)
name - The role name as used by the servletlink - The role name as used by the container.public java.lang.String getUserRoleLink(java.lang.String name)
name - The name of the role@ManagedAttribute(value="forced servlet path",
readonly=true)
public java.lang.String getForcedPath()
public void setForcedPath(java.lang.String forcedPath)
forcedPath - The forcedPath to set.public boolean isEnabled()
public void setEnabled(boolean enabled)
public void doStart()
throws java.lang.Exception
doStart in class BaseHolder<javax.servlet.Servlet>java.lang.Exceptionpublic void initialize()
throws java.lang.Exception
BaseHolderinitialize in class BaseHolder<javax.servlet.Servlet>java.lang.Exception - if unable to initializepublic void doStop()
throws java.lang.Exception
doStop in class BaseHolder<javax.servlet.Servlet>java.lang.Exceptionpublic void destroyInstance(java.lang.Object o)
throws java.lang.Exception
destroyInstance in class Holder<javax.servlet.Servlet>java.lang.Exceptionpublic javax.servlet.Servlet getServlet()
throws javax.servlet.ServletException
javax.servlet.ServletException - if unable to init the servlet on first usepublic javax.servlet.Servlet getServletInstance()
public void checkServletType()
throws javax.servlet.UnavailableException
javax.servlet.UnavailableException - if Servlet class is not of type Servletpublic boolean isAvailable()
protected void initJspServlet()
throws java.lang.Exception
java.lang.Exception - if unable to init the JSP Servletprotected void initMultiPart()
throws java.lang.Exception
java.lang.Exception - if unable to init the multipartpublic java.lang.String getContextPath()
getContextPath in interface org.eclipse.jetty.server.UserIdentity.ScopeUserIdentity.Scope.getContextPath()public java.util.Map<java.lang.String,java.lang.String> getRoleRefMap()
getRoleRefMap in interface org.eclipse.jetty.server.UserIdentity.ScopeUserIdentity.Scope.getRoleRefMap()@ManagedAttribute(value="role to run servlet as",
readonly=true)
public java.lang.String getRunAsRole()
public void setRunAsRole(java.lang.String role)
protected void prepare(org.eclipse.jetty.server.Request baseRequest,
javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response)
throws javax.servlet.ServletException,
javax.servlet.UnavailableException
baseRequest - the base requestrequest - the requestresponse - the responsejavax.servlet.ServletException - if unable to prepare the servletjavax.servlet.UnavailableException - if not availablepublic javax.servlet.Servlet ensureInstance()
throws javax.servlet.ServletException,
javax.servlet.UnavailableException
javax.servlet.ServletExceptionjavax.servlet.UnavailableExceptionpublic void handle(org.eclipse.jetty.server.Request baseRequest,
javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response)
throws javax.servlet.ServletException,
javax.servlet.UnavailableException,
java.io.IOException
baseRequest - the base requestrequest - the requestresponse - the responsejavax.servlet.ServletException - if unable to process the servletjavax.servlet.UnavailableException - if servlet is unavailablejava.io.IOException - if unable to process the request or responsepublic java.lang.String getNameOfJspClass(java.lang.String jsp)
jsp - the jsp-filepublic java.lang.String getPackageOfJspClass(java.lang.String jsp)
public java.lang.String getJspPackagePrefix()
public java.lang.String getClassNameForJsp(java.lang.String jsp)
jsp - the jsp-file from web.xmlprotected void appendPath(java.lang.StringBuffer path,
java.lang.String element)
path - the path under constructionelement - the element of the name to addpublic javax.servlet.ServletRegistration.Dynamic getRegistration()
protected javax.servlet.Servlet newInstance()
throws javax.servlet.ServletException,
java.lang.IllegalAccessException,
java.lang.InstantiationException
javax.servlet.ServletException - if unable to create a new instancejava.lang.IllegalAccessException - if not allowed to create a new instancejava.lang.InstantiationException - if creating new instance resulted in errorCopyright © 1995–2018 Webtide. All rights reserved.