|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.server.handler.AbstractHandler
org.eclipse.jetty.servlet.ServletHandler
public class ServletHandler
Servlet HttpHandler. This handler maps requests to servlets that implement the javax.servlet.http.HttpServlet API.
This handler does not implement the full J2EE features and is intended to
be used when a full web application is not required. Specifically filters
and request wrapping are not supported.
Unless run as part of a ServletContextHandler
or derivative, the initialize()
method must be called manually after start().
org.eclipse.jetty.webapp.WebAppContext
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle |
---|
LifeCycle.Listener |
Field Summary | |
---|---|
static java.lang.String |
__DEFAULT_SERVLET
|
protected java.util.concurrent.ConcurrentHashMap[] |
_chainCache
|
Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle |
---|
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING |
Constructor Summary | |
---|---|
ServletHandler()
Constructor. |
Method Summary | |
---|---|
void |
addFilter(FilterHolder filter)
Convenience method to add a preconstructed FilterHolder |
void |
addFilter(FilterHolder filter,
FilterMapping filterMapping)
convenience method to add a filter and mapping |
FilterHolder |
addFilter(java.lang.String className,
java.lang.String pathSpec,
int dispatches)
Deprecated. |
void |
addFilterMapping(FilterMapping mapping)
Convenience method to add a preconstructed FilterMapping |
FilterHolder |
addFilterWithMapping(java.lang.Class<? extends javax.servlet.Filter> filter,
java.lang.String pathSpec,
int dispatches)
conveniance method to add a filter. |
void |
addFilterWithMapping(FilterHolder holder,
java.lang.String pathSpec,
int dispatches)
conveniance method to add a filter. |
FilterHolder |
addFilterWithMapping(java.lang.String className,
java.lang.String pathSpec,
int dispatches)
conveniance method to add a filter. |
void |
addServlet(ServletHolder holder)
Convenience method to add a pre-constructed ServletHolder. |
ServletHolder |
addServlet(java.lang.String className,
java.lang.String pathSpec)
Deprecated. |
void |
addServletMapping(ServletMapping mapping)
Convenience method to add a pre-constructed ServletMapping. |
ServletHolder |
addServletWithMapping(java.lang.Class<? extends javax.servlet.Servlet> servlet,
java.lang.String pathSpec)
conveniance method to add a servlet. |
void |
addServletWithMapping(ServletHolder servlet,
java.lang.String pathSpec)
conveniance method to add a servlet. |
ServletHolder |
addServletWithMapping(java.lang.String className,
java.lang.String pathSpec)
conveniance method to add a servlet. |
javax.servlet.Filter |
customizeFilter(javax.servlet.Filter filter)
Customize a Filter. |
javax.servlet.Filter |
customizeFilterDestroy(javax.servlet.Filter filter)
|
javax.servlet.Servlet |
customizeServlet(javax.servlet.Servlet servlet)
Customize a servlet. |
javax.servlet.Servlet |
customizeServletDestroy(javax.servlet.Servlet servlet)
|
protected void |
doStart()
|
protected void |
doStop()
|
protected void |
dump(java.lang.StringBuilder b,
java.lang.String indent)
|
java.lang.Object |
getContextLog()
|
FilterHolder |
getFilter(java.lang.String name)
|
FilterMapping[] |
getFilterMappings()
|
FilterHolder[] |
getFilters()
Get Filters. |
PathMap.Entry |
getHolderEntry(java.lang.String pathInContext)
ServletHolder matching path. |
int |
getMaxFilterChainsCacheSize()
|
javax.servlet.RequestDispatcher |
getRequestDispatcher(java.lang.String uriInContext)
|
ServletHolder |
getServlet(java.lang.String name)
|
javax.servlet.ServletContext |
getServletContext()
|
ServletMapping[] |
getServletMappings()
|
ServletHolder[] |
getServlets()
Get Servlets. |
void |
handle(java.lang.String target,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
|
void |
initialize()
Initialize filters and load-on-startup servlets. |
boolean |
isAvailable()
|
boolean |
isFilterChainsCached()
|
boolean |
isInitializeAtStart()
Deprecated. |
boolean |
isStartWithUnavailable()
|
FilterHolder |
newFilterHolder()
|
FilterHolder |
newFilterHolder(java.lang.Class<? extends javax.servlet.Filter> filter)
|
ServletHolder |
newServletHolder()
see also newServletHolder(Class) |
ServletHolder |
newServletHolder(java.lang.Class servlet)
|
protected void |
notFound(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
|
void |
prependFilterMapping(FilterMapping mapping)
Convenience method to add a preconstructed FilterMapping |
void |
setFilterChainsCached(boolean filterChainsCached)
|
void |
setFilterMappings(FilterMapping[] filterMappings)
|
void |
setFilters(FilterHolder[] holders)
|
void |
setInitializeAtStart(boolean initializeAtStart)
Deprecated. |
void |
setMaxFilterChainsCacheSize(int maxFilterChainsCacheSize)
Set the maximum filter chain cache size. |
void |
setServer(Server server)
|
void |
setServletMappings(ServletMapping[] servletMappings)
|
void |
setServlets(ServletHolder[] holders)
Set Servlets. |
void |
setStartWithUnavailable(boolean start)
|
protected void |
updateMappings()
|
protected void |
updateNameMappings()
|
Methods inherited from class org.eclipse.jetty.server.handler.AbstractHandler |
---|
destroy, dump, getServer, 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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle |
---|
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop |
Field Detail |
---|
public static final java.lang.String __DEFAULT_SERVLET
protected transient java.util.concurrent.ConcurrentHashMap[] _chainCache
Constructor Detail |
---|
public ServletHandler()
Method Detail |
---|
public void setServer(Server server)
setServer
in interface Handler
setServer
in class AbstractHandler
protected void doStart() throws java.lang.Exception
doStart
in class AbstractHandler
java.lang.Exception
protected void doStop() throws java.lang.Exception
doStop
in class AbstractHandler
java.lang.Exception
public java.lang.Object getContextLog()
public FilterMapping[] getFilterMappings()
public FilterHolder[] getFilters()
public PathMap.Entry getHolderEntry(java.lang.String pathInContext)
pathInContext
- Path within _context.
public javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String uriInContext)
uriInContext
- uri to get dispatcher for
dispatcher
wrapping the resource at uriInContext
,
or null
if the specified uri cannot be dispatched to.public javax.servlet.ServletContext getServletContext()
public ServletMapping[] getServletMappings()
public ServletHolder[] getServlets()
public ServletHolder getServlet(java.lang.String name)
public void handle(java.lang.String target, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException
java.io.IOException
javax.servlet.ServletException
public boolean isInitializeAtStart()
public void setInitializeAtStart(boolean initializeAtStart)
initializeAtStart
- The initializeAtStart to set.public boolean isAvailable()
public void setStartWithUnavailable(boolean start)
start
- True if this handler will start with unavailable servletspublic boolean isStartWithUnavailable()
public void initialize() throws java.lang.Exception
java.lang.Exception
public boolean isFilterChainsCached()
public ServletHolder newServletHolder()
public ServletHolder newServletHolder(java.lang.Class servlet)
public ServletHolder addServletWithMapping(java.lang.String className, java.lang.String pathSpec)
public ServletHolder addServletWithMapping(java.lang.Class<? extends javax.servlet.Servlet> servlet, java.lang.String pathSpec)
public void addServletWithMapping(ServletHolder servlet, java.lang.String pathSpec)
servlet
- servlet holder to addpathSpec
- servlet mappings for the servletHolderpublic ServletHolder addServlet(java.lang.String className, java.lang.String pathSpec)
className
- pathSpec
-
public void addServlet(ServletHolder holder)
holder
- public void addServletMapping(ServletMapping mapping)
mapping
- public FilterHolder newFilterHolder(java.lang.Class<? extends javax.servlet.Filter> filter)
public FilterHolder newFilterHolder()
#newFilterHolder(Class)}
public FilterHolder getFilter(java.lang.String name)
public FilterHolder addFilterWithMapping(java.lang.Class<? extends javax.servlet.Filter> filter, java.lang.String pathSpec, int dispatches)
filter
- class of filter to createpathSpec
- filter mappings for filterdispatches
- see FilterMapping.setDispatches(int)
public FilterHolder addFilterWithMapping(java.lang.String className, java.lang.String pathSpec, int dispatches)
className
- of filterpathSpec
- filter mappings for filterdispatches
- see FilterMapping.setDispatches(int)
public void addFilterWithMapping(FilterHolder holder, java.lang.String pathSpec, int dispatches)
holder
- filter holder to addpathSpec
- filter mappings for filterdispatches
- see FilterMapping.setDispatches(int)
public FilterHolder addFilter(java.lang.String className, java.lang.String pathSpec, int dispatches)
className
- pathSpec
- dispatches
-
public void addFilter(FilterHolder filter, FilterMapping filterMapping)
filter
- filterMapping
- public void addFilter(FilterHolder filter)
filter
- public void addFilterMapping(FilterMapping mapping)
mapping
- public void prependFilterMapping(FilterMapping mapping)
mapping
- protected void updateNameMappings()
protected void updateMappings()
protected void notFound(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
java.io.IOException
public void setFilterChainsCached(boolean filterChainsCached)
filterChainsCached
- The filterChainsCached to set.public void setFilterMappings(FilterMapping[] filterMappings)
filterMappings
- The filterMappings to set.public void setFilters(FilterHolder[] holders)
public void setServletMappings(ServletMapping[] servletMappings)
servletMappings
- The servletMappings to set.public void setServlets(ServletHolder[] holders)
holders
- Array of servletsto definepublic int getMaxFilterChainsCacheSize()
public void setMaxFilterChainsCacheSize(int maxFilterChainsCacheSize)
isFilterChainsCached()
is true. If the max cache size
is greater than zero, then the cache is flushed whenever it grows to be this size.
maxFilterChainsCacheSize
- the maximum number of entries in a filter chain cache.public javax.servlet.Servlet customizeServlet(javax.servlet.Servlet servlet) throws java.lang.Exception
servlet
-
java.lang.Exception
public javax.servlet.Servlet customizeServletDestroy(javax.servlet.Servlet servlet) throws java.lang.Exception
java.lang.Exception
public javax.servlet.Filter customizeFilter(javax.servlet.Filter filter) throws java.lang.Exception
filter
-
java.lang.Exception
public javax.servlet.Filter customizeFilterDestroy(javax.servlet.Filter filter) throws java.lang.Exception
java.lang.Exception
protected void dump(java.lang.StringBuilder b, java.lang.String indent)
dump
in class AbstractHandler
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |