|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.mortbay.component.AbstractLifeCycle org.mortbay.jetty.handler.AbstractHandler org.mortbay.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 Context
or derivative, the initialize()
method must be called manually after start().
WebAppContext
Field Summary | |
---|---|
static String |
__DEFAULT_SERVLET
|
static String |
__J_S_CONTEXT_TEMPDIR
|
static String |
__J_S_ERROR_EXCEPTION
|
static String |
__J_S_ERROR_EXCEPTION_TYPE
|
static String |
__J_S_ERROR_MESSAGE
|
static String |
__J_S_ERROR_REQUEST_URI
|
static String |
__J_S_ERROR_SERVLET_NAME
|
static String |
__J_S_ERROR_STATUS_CODE
|
protected HashMap[] |
_chainCache
|
Fields inherited from class org.mortbay.jetty.handler.AbstractHandler |
---|
_string |
Fields inherited from interface org.mortbay.jetty.Handler |
---|
ALL, DEFAULT, ERROR, FORWARD, INCLUDE, REQUEST |
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(String className,
String pathSpec,
int dispatches)
Deprecated. |
void |
addFilterMapping(FilterMapping mapping)
Convenience method to add a preconstructed FilterMapping |
FilterHolder |
addFilterWithMapping(Class filter,
String pathSpec,
int dispatches)
conveniance method to add a filter. |
void |
addFilterWithMapping(FilterHolder holder,
String pathSpec,
int dispatches)
conveniance method to add a filter. |
FilterHolder |
addFilterWithMapping(String className,
String pathSpec,
int dispatches)
conveniance method to add a filter. |
void |
addServlet(ServletHolder holder)
Convenience method to add a pre-constructed ServletHolder. |
ServletHolder |
addServlet(String className,
String pathSpec)
Deprecated. |
void |
addServletMapping(ServletMapping mapping)
Convenience method to add a pre-constructed ServletMapping. |
ServletHolder |
addServletWithMapping(Class servlet,
String pathSpec)
conveniance method to add a servlet. |
void |
addServletWithMapping(ServletHolder servlet,
String pathSpec)
conveniance method to add a servlet. |
ServletHolder |
addServletWithMapping(String className,
String pathSpec)
conveniance method to add a servlet. |
Filter |
customizeFilter(Filter filter)
Customize a Filter. |
Filter |
customizeFilterDestroy(Filter filter)
|
Servlet |
customizeServlet(Servlet servlet)
Customize a servlet. |
Servlet |
customizeServletDestroy(Servlet servlet)
|
protected void |
doStart()
|
protected void |
doStop()
|
Object |
getContextLog()
|
FilterHolder |
getFilter(String name)
|
FilterMapping[] |
getFilterMappings()
|
FilterHolder[] |
getFilters()
Get Filters. |
PathMap.Entry |
getHolderEntry(String pathInContext)
ServletHolder matching path. |
int |
getMaxFilterChainsCacheSize()
|
RequestDispatcher |
getRequestDispatcher(String uriInContext)
|
ServletHolder |
getServlet(String name)
|
ServletContext |
getServletContext()
|
ServletMapping[] |
getServletMappings()
|
ServletHolder[] |
getServlets()
Get Servlets. |
void |
handle(String target,
HttpServletRequest request,
HttpServletResponse response,
int type)
Handle a request. |
void |
initialize()
Initialize filters and load-on-startup servlets. |
boolean |
isAvailable()
|
boolean |
isFilterChainsCached()
|
boolean |
isInitializeAtStart()
Deprecated. |
FilterHolder |
newFilterHolder()
|
FilterHolder |
newFilterHolder(Class filter)
|
ServletHolder |
newServletHolder()
|
ServletHolder |
newServletHolder(Class servlet)
|
protected void |
notFound(HttpServletRequest request,
HttpServletResponse response)
|
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. |
protected void |
updateMappings()
|
protected void |
updateNameMappings()
|
Methods inherited from class org.mortbay.jetty.handler.AbstractHandler |
---|
destroy, getServer, 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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.mortbay.component.LifeCycle |
---|
isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, start, stop |
Field Detail |
---|
public static final String __DEFAULT_SERVLET
public static final String __J_S_CONTEXT_TEMPDIR
public static final String __J_S_ERROR_EXCEPTION
public static final String __J_S_ERROR_EXCEPTION_TYPE
public static final String __J_S_ERROR_MESSAGE
public static final String __J_S_ERROR_REQUEST_URI
public static final String __J_S_ERROR_SERVLET_NAME
public static final String __J_S_ERROR_STATUS_CODE
protected transient HashMap[] _chainCache
Constructor Detail |
---|
public ServletHandler()
Method Detail |
---|
public void setServer(Server server)
setServer
in interface Handler
setServer
in class AbstractHandler
protected void doStart() throws Exception
doStart
in class AbstractHandler
Exception
protected void doStop() throws Exception
doStop
in class AbstractHandler
Exception
public Object getContextLog()
public FilterMapping[] getFilterMappings()
public FilterHolder[] getFilters()
public PathMap.Entry getHolderEntry(String pathInContext)
pathInContext
- Path within _context.
public RequestDispatcher getRequestDispatcher(String uriInContext)
dispatcher
wrapping the resource at uriInContext
,
or null
if the specified uri cannot be dispatched to.public ServletContext getServletContext()
public ServletMapping[] getServletMappings()
public ServletHolder[] getServlets()
public ServletHolder getServlet(String name)
public void handle(String target, HttpServletRequest request, HttpServletResponse response, int type) throws IOException, ServletException
Handler
target
- The target of the request - either a URI or a name.request
- The request either as the Request
object or a wrapper of that request. The HttpConnection.getCurrentConnection()
method can be used access the Request object if required.response
- The response as the Response
object or a wrapper of that request. The HttpConnection.getCurrentConnection()
method can be used access the Response object if required.type
- The dispatch mode: Handler.REQUEST
, Handler.FORWARD
, Handler.INCLUDE
, Handler.ERROR
IOException
ServletException
public boolean isInitializeAtStart()
public void setInitializeAtStart(boolean initializeAtStart)
initializeAtStart
- The initializeAtStart to set.public boolean isAvailable()
public void initialize() throws Exception
Exception
public boolean isFilterChainsCached()
public ServletHolder newServletHolder()
newServletHolder(Class)
public ServletHolder newServletHolder(Class servlet)
public ServletHolder addServletWithMapping(String className, String pathSpec)
public ServletHolder addServletWithMapping(Class servlet, String pathSpec)
public void addServletWithMapping(ServletHolder servlet, String pathSpec)
name
- className
- pathSpec
- public ServletHolder addServlet(String className, String pathSpec)
className
- pathSpec
-
public void addServlet(ServletHolder holder)
holder
- public void addServletMapping(ServletMapping mapping)
mapping
- public FilterHolder newFilterHolder(Class filter)
public FilterHolder newFilterHolder()
#newFilterHolder(Class)}
public FilterHolder getFilter(String name)
public FilterHolder addFilterWithMapping(Class filter, String pathSpec, int dispatches)
name
- className
- pathSpec
- dispatches
- see FilterMapping.setDispatches(int)
public FilterHolder addFilterWithMapping(String className, String pathSpec, int dispatches)
name
- className
- pathSpec
- dispatches
- see FilterMapping.setDispatches(int)
public void addFilterWithMapping(FilterHolder holder, String pathSpec, int dispatches)
name
- className
- pathSpec
- dispatches
- see FilterMapping.setDispatches(int)
public FilterHolder addFilter(String className, 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
- protected void updateNameMappings()
protected void updateMappings()
protected void notFound(HttpServletRequest request, HttpServletResponse response) throws IOException
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 Servlet customizeServlet(Servlet servlet) throws Exception
servlet
-
Exception
public Servlet customizeServletDestroy(Servlet servlet) throws Exception
Exception
public Filter customizeFilter(Filter filter) throws Exception
filter
-
Exception
public Filter customizeFilterDestroy(Filter filter) throws Exception
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |