|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.mortbay.http.handler.AbstractHttpHandler | +--org.mortbay.jetty.servlet.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.
If a SessionManager is not added to the handler before it is initialized, then a HashSessionManager with a standard java.util.Random generator is created.
WebApplicationHandler
,
Serialized FormField Summary | |
static java.lang.String |
__DEFAULT_SERVLET
|
Constructor Summary | |
ServletHandler()
Constructor. |
Method Summary | |
void |
addEventListener(java.util.EventListener listener)
|
ServletHolder |
addServlet(java.lang.String pathSpec,
java.lang.String servletClass)
|
ServletHolder |
addServlet(java.lang.String name,
java.lang.String pathSpec,
java.lang.String servletClass)
Add a servlet. |
ServletHolder |
addServlet(java.lang.String name,
java.lang.String pathSpec,
java.lang.String servletClass,
java.lang.String forcedPath)
Add a servlet. |
void |
formAuthInit(java.lang.String formLoginPage,
java.lang.String formErrorPage)
|
java.lang.ClassLoader |
getClassLoader()
|
java.util.Map.Entry |
getHolderEntry(java.lang.String pathInContext)
ServletHolder matching path. |
LogSink |
getLogSink()
|
RequestDispatcher |
getNamedDispatcher(java.lang.String name)
Get Named dispatcher. |
java.lang.String |
getRealPath(java.lang.String path)
|
RequestDispatcher |
getRequestDispatcher(java.lang.String uriInContext)
|
java.net.URL |
getResource(java.lang.String uriInContext)
Get a Resource. |
java.io.InputStream |
getResourceAsStream(java.lang.String uriInContext)
|
java.util.Set |
getResourcePaths(java.lang.String uriInContext)
|
ServletContext |
getServletContext()
|
ServletHolder |
getServletHolder(java.lang.String name)
|
PathMap |
getServletMap()
|
ServletHolder[] |
getServlets()
Get Servlets. |
SessionManager |
getSessionManager()
|
void |
handle(java.lang.String pathInContext,
java.lang.String pathParams,
HttpRequest httpRequest,
HttpResponse httpResponse)
Handle request. |
void |
initialize(HttpContext context)
Initialize with a HttpContext. |
void |
initializeServlets()
Initialize load-on-startup servlets. |
boolean |
isAutoInitializeServlets()
|
boolean |
isUsingCookies()
|
ServletHolder |
mapPathToServlet(java.lang.String pathSpec,
java.lang.String servletName)
|
ServletHolder |
newServletHolder(java.lang.String name,
java.lang.String servletClass)
|
ServletHolder |
newServletHolder(java.lang.String name,
java.lang.String servletClass,
java.lang.String forcedPath)
|
void |
removeEventListener(java.util.EventListener listener)
|
void |
setAutoInitializeServlets(boolean b)
|
void |
setDynamicInitParams(java.util.Map initParams)
Deprecated. Use org.mortbay.jetty.servlet.Invoker |
void |
setDynamicServletPathSpec(java.lang.String dynamicServletPathSpec)
Deprecated. Use org.mortbay.jetty.servlet.Invoker |
void |
setLogSink(LogSink logSink)
|
void |
setServeDynamicSystemServlets(boolean b)
Deprecated. Use org.mortbay.jetty.servlet.Invoker |
void |
setSessionManager(SessionManager sm)
|
void |
setUsingCookies(boolean uc)
|
void |
start()
Start the LifeCycle. |
void |
stop()
Stop the LifeCycle. |
Methods inherited from class org.mortbay.http.handler.AbstractHttpHandler |
getHttpContext, getName, handleTrace, isStarted, setName, toString |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String __DEFAULT_SERVLET
Constructor Detail |
public ServletHandler()
Method Detail |
public void initialize(HttpContext context)
AbstractHttpHandler
initialize
in interface HttpHandler
initialize
in class AbstractHttpHandler
context
- Must be the HttpContext of the handlerpublic void formAuthInit(java.lang.String formLoginPage, java.lang.String formErrorPage)
public void setSessionManager(SessionManager sm)
public SessionManager getSessionManager()
public ServletContext getServletContext()
public PathMap getServletMap()
public boolean isUsingCookies()
public void setDynamicServletPathSpec(java.lang.String dynamicServletPathSpec)
public void setDynamicInitParams(java.util.Map initParams)
public void setServeDynamicSystemServlets(boolean b)
public java.lang.ClassLoader getClassLoader()
public void setUsingCookies(boolean uc)
uc
- If true, cookies are used for sessionspublic void setLogSink(LogSink logSink)
public LogSink getLogSink()
public ServletHolder newServletHolder(java.lang.String name, java.lang.String servletClass, java.lang.String forcedPath)
public ServletHolder newServletHolder(java.lang.String name, java.lang.String servletClass)
public ServletHolder getServletHolder(java.lang.String name)
public ServletHolder mapPathToServlet(java.lang.String pathSpec, java.lang.String servletName)
public ServletHolder addServlet(java.lang.String name, java.lang.String pathSpec, java.lang.String servletClass, java.lang.String forcedPath)
name
- The servlet name.pathSpec
- A path specification to map this servlet to.servletClass
- The class name of the servlet.forcedPath
- If non null, the request attribute
javax.servlet.include.servlet_path will be set to this path before
service is called.
public ServletHolder addServlet(java.lang.String name, java.lang.String pathSpec, java.lang.String servletClass)
name
- The servlet name.pathSpec
- A path specification to map this servlet to.servletClass
- The class name of the servlet.
public ServletHolder addServlet(java.lang.String pathSpec, java.lang.String servletClass)
public void addEventListener(java.util.EventListener listener) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public void removeEventListener(java.util.EventListener listener)
public boolean isAutoInitializeServlets()
public void setAutoInitializeServlets(boolean b)
public void start() throws java.lang.Exception
LifeCycle
start
in interface LifeCycle
start
in class AbstractHttpHandler
java.lang.Exception
- An arbitrary exception may be thrown.public ServletHolder[] getServlets()
public void initializeServlets() throws java.lang.Exception
java.lang.Exception
public void stop() throws java.lang.InterruptedException
LifeCycle
stop
in interface LifeCycle
stop
in class AbstractHttpHandler
java.lang.InterruptedException
- Stopping a lifecycle is rarely atomic
and may be interrupted by another thread. If this happens
InterruptedException is throw and the component will be in an
indeterminant state and should probably be discarded.public void handle(java.lang.String pathInContext, java.lang.String pathParams, HttpRequest httpRequest, HttpResponse httpResponse) throws java.io.IOException
pathInContext
- pathParams
- httpRequest
- httpResponse
-
java.io.IOException
public java.util.Map.Entry getHolderEntry(java.lang.String pathInContext)
pathInContext
- Path within context.
public java.util.Set getResourcePaths(java.lang.String uriInContext)
public java.net.URL getResource(java.lang.String uriInContext) throws java.net.MalformedURLException
uriInContext
-
java.net.MalformedURLException
public java.io.InputStream getResourceAsStream(java.lang.String uriInContext)
public java.lang.String getRealPath(java.lang.String path)
public RequestDispatcher getRequestDispatcher(java.lang.String uriInContext)
public RequestDispatcher getNamedDispatcher(java.lang.String name)
name
- The name of the servlet. If null or empty string, the
containers default servlet is returned.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |