public class BetterTomcat extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
BetterTomcat.Protocol
The valid protocol types
|
| Constructor and Description |
|---|
BetterTomcat() |
BetterTomcat(int port) |
| Modifier and Type | Method and Description |
|---|---|
org.apache.catalina.connector.Connector |
addConnector(BetterTomcat.Protocol protocol,
String address,
int port)
Get a Tomcat Connector.
|
org.apache.catalina.connector.Connector |
addConnector(int port) |
org.apache.catalina.Context |
addContext(org.apache.catalina.Host host,
String contextPath,
String dir) |
org.apache.catalina.Context |
addContext(String contextPath,
String baseDir)
Add a context - programmatic mode, no web.xml used.
|
org.apache.catalina.Wrapper |
addServlet(String contextPath,
String servletName,
javax.servlet.Servlet servlet)
Add an existing Servlet to the context with no class.forName or
initialisation.
|
org.apache.catalina.Wrapper |
addServlet(String contextPath,
String servletName,
String servletClass)
Equivalent with
|
org.apache.catalina.Context |
addWebapp(org.apache.catalina.Host host,
String contextPath,
String webappFilePath)
Add a webapp to a particular Host
|
org.apache.catalina.Context |
addWebapp(String contextPath,
String webappFilePath)
Add a webapp using normal WEB-INF/web.xml if found.
|
void |
enableNaming()
Enables JNDI naming which is disabled by default.
|
org.apache.catalina.connector.Connector |
getConnector(BetterTomcat.Protocol protocol,
String address,
int port) |
org.apache.catalina.Host |
getHost() |
org.apache.catalina.startup.Tomcat |
getTomcat()
Returns the wrapped Tomcat instance.
|
void |
setBaseDir(String baseDir) |
void |
setClientAuth(org.apache.catalina.connector.Connector connector,
String clientAuth) |
void |
setDefaultHost(String defaultHostName) |
void |
setDefaultRealm(org.apache.catalina.Realm realm) |
void |
setUnpackWars(boolean unpackWars)
Indicates whether WAR files should be unpacked or not
|
void |
start()
Start the server.
|
void |
stop()
Stop the server.
|
public void setUnpackWars(boolean unpackWars)
unpackWars - true - unpackWarspublic void start()
throws org.apache.catalina.LifecycleException
org.apache.catalina.LifecycleException - If an irrecoverable error occurs while startingpublic void stop()
throws org.apache.catalina.LifecycleException
org.apache.catalina.LifecycleException - If an irrecoverable error occurs while stoppingpublic org.apache.catalina.Host getHost()
public org.apache.catalina.Context addWebapp(String contextPath, String webappFilePath) throws BetterTomcatException
contextPath - The context of the webapp, e.g., /foowebappFilePath - The file path of the webapp. Can be the path to a WAR file or a
directory,
e.g.,
1. /home/azeez/bettertomcat/foo.war
2. /home/azeez/bettertomcat/fooBetterTomcatException - If webapp deployment failspublic org.apache.catalina.Context addWebapp(org.apache.catalina.Host host,
String contextPath,
String webappFilePath)
host - The Host to which this webapp is added tocontextPath - The context of the webapp, e.g., /foowebappFilePath - The file path of the webapp. Can be the path to a WAR file or a
directory,
e.g.,
1. /home/azeez/bettertomcat/foo.war
2. /home/azeez/bettertomcat/foopublic org.apache.catalina.Context addContext(String contextPath, String baseDir)
contextPath - The context of the webapp. "" for root context.baseDir - base dir for the context, for static files. Must exist,
relative to the server homepublic org.apache.catalina.Context addContext(org.apache.catalina.Host host,
String contextPath,
String dir)
public org.apache.catalina.Wrapper addServlet(String contextPath, String servletName, String servletClass)
contextPath - Context to add Servlet toservletName - Servlet name (used in mappings)servletClass - The class to be used for the Servletpublic org.apache.catalina.Wrapper addServlet(String contextPath, String servletName, javax.servlet.Servlet servlet)
contextPath - Context to add Servlet toservletName - Servlet name (used in mappings)servlet - The Servlet to addpublic void enableNaming()
Lifecycle in order for the
NamingContextListener to be used.public org.apache.catalina.connector.Connector addConnector(int port)
public org.apache.catalina.connector.Connector addConnector(BetterTomcat.Protocol protocol, String address, int port)
protocol - The protocol of the connector.address - The IP address of the network interface to which this connector should bind
to. Specify this as null if the connector should bind to all network interfaces.port - The port on which this connector has to be runpublic void setClientAuth(org.apache.catalina.connector.Connector connector,
String clientAuth)
public org.apache.catalina.connector.Connector getConnector(BetterTomcat.Protocol protocol, String address, int port)
public void setBaseDir(String baseDir)
public void setDefaultHost(String defaultHostName)
public void setDefaultRealm(org.apache.catalina.Realm realm)
public org.apache.catalina.startup.Tomcat getTomcat()
Copyright © 2011-2013 The Apache Software Foundation. All Rights Reserved.