|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.oozie.test.EmbeddedServletContainer
public class EmbeddedServletContainer
An embedded servlet container for testing purposes.
It provides reduced functionality, it supports only Servlets. The servlet container is started in a free port.
Constructor Summary | |
---|---|
EmbeddedServletContainer(String contextPath)
Create a servlet container. |
Method Summary | |
---|---|
void |
addFilter(String filterPath,
Class filterClass)
Add a filter to the container. |
void |
addServletEndpoint(String servletPath,
Class servletClass)
Add a servlet to the container. |
void |
addServletEndpoint(String servletPath,
Class servletClass,
Map<String,String> initParams)
Add a servlet to the container. |
String |
getContextURL()
Return the full URL (including protocol, host, port, context path, servlet path) for the context path. |
String |
getHost()
Return the hostname the servlet container is bound to. |
int |
getPort()
Return the port number the servlet container is bound to. |
String |
getServletURL(String servletPath)
Return the full URL (including protocol, host, port, context path, servlet path) for a servlet path. |
void |
start()
Start the servlet container. |
void |
stop()
Stop the servlet container. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EmbeddedServletContainer(String contextPath)
contextPath
- context path for the servlet, it must not be prefixed or append with "/", for the default
context use ""Method Detail |
---|
public void addServletEndpoint(String servletPath, Class servletClass, Map<String,String> initParams)
servletPath
- servlet path for the servlet, it should be prefixed with '/", it may contain a wild card at
the end.servletClass
- servlet classinitParams
- a mapping of init parameters for the servlet, or nullpublic void addServletEndpoint(String servletPath, Class servletClass)
servletPath
- servlet path for the servlet, it should be prefixed with '/", it may contain a wild card at
the end.servletClass
- servlet classpublic void addFilter(String filterPath, Class filterClass)
filterPath
- path for the filter, it should be prefixed with '/", it may contain a wild card at
the end.filterClass
- servlet classpublic void start() throws Exception
Exception
- thrown if the container could not start.public String getHost()
public int getPort()
public String getContextURL()
public String getServletURL(String servletPath)
servletPath
- the path which will be expanded to a full URL.
public void stop()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |