public class TomcatManager extends Object
Constructor and Description |
---|
TomcatManager(URL url)
Creates a Tomcat manager wrapper for the specified URL that uses a username of
admin , an empty
password and ISO-8859-1 URL encoding. |
TomcatManager(URL url,
String username)
Creates a Tomcat manager wrapper for the specified URL and username that uses an empty password and ISO-8859-1
URL encoding.
|
TomcatManager(URL url,
String username,
String password)
Creates a Tomcat manager wrapper for the specified URL, username and password that uses ISO-8859-1 URL encoding.
|
TomcatManager(URL url,
String username,
String password,
String charset)
Creates a Tomcat manager wrapper for the specified URL, username, password and URL encoding.
|
TomcatManager(URL url,
String username,
String password,
String charset,
boolean verbose)
Creates a Tomcat manager wrapper for the specified URL, username, password and URL encoding.
|
Modifier and Type | Method and Description |
---|---|
protected String |
calculateRelocatedUrl(org.apache.http.HttpResponse response) |
TomcatManagerResponse |
deploy(String path,
File war)
Deploys the specified WAR as a HTTP PUT to the specified context path.
|
TomcatManagerResponse |
deploy(String path,
File war,
boolean update)
Deploys the specified WAR as a HTTP PUT to the specified context path, optionally undeploying the webapp if it
already exists.
|
TomcatManagerResponse |
deploy(String path,
File war,
boolean update,
String tag)
Deploys the specified WAR as a HTTP PUT to the specified context path, optionally undeploying the webapp if it
already exists and using the specified tag name.
|
TomcatManagerResponse |
deploy(String path,
File war,
boolean update,
String tag,
long length) |
TomcatManagerResponse |
deploy(String path,
URL war)
Deploys the specified WAR as a URL to the specified context path.
|
TomcatManagerResponse |
deploy(String path,
URL war,
boolean update)
Deploys the specified WAR as a URL to the specified context path, optionally undeploying the webapp if it already
exists.
|
TomcatManagerResponse |
deploy(String path,
URL war,
boolean update,
String tag)
Deploys the specified WAR as a URL to the specified context path, optionally undeploying the webapp if it already
exists and using the specified tag name.
|
TomcatManagerResponse |
deployContext(String path,
URL config)
Deploys the specified context XML configuration to the specified context path.
|
TomcatManagerResponse |
deployContext(String path,
URL config,
boolean update)
Deploys the specified context XML configuration to the specified context path, optionally undeploying the webapp
if it already exists.
|
TomcatManagerResponse |
deployContext(String path,
URL config,
boolean update,
String tag)
Deploys the specified context XML configuration to the specified context path, optionally undeploying the webapp
if it already exists and using the specified tag name.
|
TomcatManagerResponse |
deployContext(String path,
URL config,
URL war)
Deploys the specified context XML configuration and WAR as a URL to the specified context path.
|
TomcatManagerResponse |
deployContext(String path,
URL config,
URL war,
boolean update)
Deploys the specified context XML configuration and WAR as a URL to the specified context path, optionally
undeploying the webapp if it already exists.
|
TomcatManagerResponse |
deployContext(String path,
URL config,
URL war,
boolean update,
String tag)
Deploys the specified context XML configuration and WAR as a URL to the specified context path, optionally
undeploying the webapp if it already exists and using the specified tag name.
|
String |
getCharset()
Gets the URL encoding charset to use when communicating with Tomcat manager.
|
String |
getPassword()
Gets the password to use when authenticating with Tomcat manager.
|
TomcatManagerResponse |
getResources()
Lists all of the global JNDI resources.
|
TomcatManagerResponse |
getResources(String type)
Lists the global JNDI resources of the given type.
|
TomcatManagerResponse |
getRoles()
Lists the security role names and corresponding descriptions that are available.
|
TomcatManagerResponse |
getServerInfo()
Lists information about the Tomcat version, OS, and JVM properties.
|
TomcatManagerResponse |
getSessions(String path)
Lists the default session timeout and the number of currently active sessions for the given context path.
|
URL |
getURL()
Gets the full URL of the Tomcat manager instance.
|
String |
getUserAgent()
Gets the user agent name to use when communicating with Tomcat manager.
|
String |
getUserName()
Gets the username to use when authenticating with Tomcat manager.
|
protected TomcatManagerResponse |
invoke(String path)
Invokes Tomcat manager with the specified command.
|
protected TomcatManagerResponse |
invoke(String path,
File data,
long length)
Invokes Tomcat manager with the specified command and content data.
|
TomcatManagerResponse |
list()
Lists all the currently deployed web applications.
|
TomcatManagerResponse |
reload(String path)
Reloads the webapp at the specified context path.
|
void |
setProxy(org.apache.maven.settings.Proxy proxy) |
void |
setUserAgent(String userAgent)
Sets the user agent name to use when communicating with Tomcat manager.
|
TomcatManagerResponse |
start(String path)
Starts the webapp at the specified context path.
|
TomcatManagerResponse |
stop(String path)
Stops the webapp at the specified context path.
|
TomcatManagerResponse |
undeploy(String path)
Undeploys the webapp at the specified context path.
|
public TomcatManager(URL url)
admin
, an empty
password and ISO-8859-1 URL encoding.url
- the full URL of the Tomcat manager instance to usepublic TomcatManager(URL url, String username)
url
- the full URL of the Tomcat manager instance to useusername
- the username to use when authenticating with Tomcat managerpublic TomcatManager(URL url, String username, String password)
url
- the full URL of the Tomcat manager instance to useusername
- the username to use when authenticating with Tomcat managerpassword
- the password to use when authenticating with Tomcat managerpublic TomcatManager(URL url, String username, String password, String charset)
url
- the full URL of the Tomcat manager instance to useusername
- the username to use when authenticating with Tomcat managerpassword
- the password to use when authenticating with Tomcat managercharset
- the URL encoding charset to use when communicating with Tomcat managerpublic TomcatManager(URL url, String username, String password, String charset, boolean verbose)
url
- the full URL of the Tomcat manager instance to useusername
- the username to use when authenticating with Tomcat managerpassword
- the password to use when authenticating with Tomcat managercharset
- the URL encoding charset to use when communicating with Tomcat managerverbose
- if the build is in verbose mode (quiet mode otherwise)public URL getURL()
public String getUserName()
public String getPassword()
public String getCharset()
public String getUserAgent()
public void setUserAgent(String userAgent)
userAgent
- the user agent name to use when communicating with Tomcat managerpublic void setProxy(org.apache.maven.settings.Proxy proxy)
proxy
- public TomcatManagerResponse deploy(String path, URL war) throws TomcatManagerException, IOException
path
- the webapp context path to deploy towar
- the URL of the WAR to deployTomcatManagerException
- if the Tomcat manager request failsIOException
- if an i/o error occurspublic TomcatManagerResponse deploy(String path, URL war, boolean update) throws TomcatManagerException, IOException
path
- the webapp context path to deploy towar
- the URL of the WAR to deployupdate
- whether to first undeploy the webapp if it already existsTomcatManagerException
- if the Tomcat manager request failsIOException
- if an i/o error occurspublic TomcatManagerResponse deploy(String path, URL war, boolean update, String tag) throws TomcatManagerException, IOException
path
- the webapp context path to deploy towar
- the URL of the WAR to deployupdate
- whether to first undeploy the webapp if it already existstag
- the tag name to useTomcatManagerException
- if the Tomcat manager request failsIOException
- if an i/o error occurspublic TomcatManagerResponse deploy(String path, File war) throws TomcatManagerException, IOException
path
- the webapp context path to deploy towar
- an input stream to the WAR to deployTomcatManagerException
- if the Tomcat manager request failsIOException
- if an i/o error occurspublic TomcatManagerResponse deploy(String path, File war, boolean update) throws TomcatManagerException, IOException
path
- the webapp context path to deploy towar
- an input stream to the WAR to deployupdate
- whether to first undeploy the webapp if it already existsTomcatManagerException
- if the Tomcat manager request failsIOException
- if an i/o error occurspublic TomcatManagerResponse deploy(String path, File war, boolean update, String tag) throws TomcatManagerException, IOException
path
- the webapp context path to deploy towar
- an input stream to the WAR to deployupdate
- whether to first undeploy the webapp if it already existstag
- the tag name to useTomcatManagerException
- if the Tomcat manager request failsIOException
- if an i/o error occurspublic TomcatManagerResponse deploy(String path, File war, boolean update, String tag, long length) throws TomcatManagerException, IOException
path
- war
- update
- tag
- length
- TomcatManagerException
IOException
public TomcatManagerResponse deployContext(String path, URL config) throws TomcatManagerException, IOException
path
- the webapp context path to deploy toconfig
- the URL of the context XML configuration to deployTomcatManagerException
- if the Tomcat manager request failsIOException
- if an i/o error occurspublic TomcatManagerResponse deployContext(String path, URL config, boolean update) throws TomcatManagerException, IOException
path
- the webapp context path to deploy toconfig
- the URL of the context XML configuration to deployupdate
- whether to first undeploy the webapp if it already existsTomcatManagerException
- if the Tomcat manager request failsIOException
- if an i/o error occurspublic TomcatManagerResponse deployContext(String path, URL config, boolean update, String tag) throws TomcatManagerException, IOException
path
- the webapp context path to deploy toconfig
- the URL of the context XML configuration to deployupdate
- whether to first undeploy the webapp if it already existstag
- the tag name to useTomcatManagerException
- if the Tomcat manager request failsIOException
- if an i/o error occurspublic TomcatManagerResponse deployContext(String path, URL config, URL war) throws TomcatManagerException, IOException
path
- the webapp context path to deploy toconfig
- the URL of the context XML configuration to deploywar
- the URL of the WAR to deployTomcatManagerException
- if the Tomcat manager request failsIOException
- if an i/o error occurspublic TomcatManagerResponse deployContext(String path, URL config, URL war, boolean update) throws TomcatManagerException, IOException
path
- the webapp context path to deploy toconfig
- the URL of the context XML configuration to deploywar
- the URL of the WAR to deployupdate
- whether to first undeploy the webapp if it already existsTomcatManagerException
- if the Tomcat manager request failsIOException
- if an i/o error occurspublic TomcatManagerResponse deployContext(String path, URL config, URL war, boolean update, String tag) throws TomcatManagerException, IOException
path
- the webapp context path to deploy toconfig
- the URL of the context XML configuration to deploywar
- the URL of the WAR to deployupdate
- whether to first undeploy the webapp if it already existstag
- the tag name to useTomcatManagerException
- if the Tomcat manager request failsIOException
- if an i/o error occurspublic TomcatManagerResponse undeploy(String path) throws TomcatManagerException, IOException
path
- the webapp context path to undeployTomcatManagerException
- if the Tomcat manager request failsIOException
- if an i/o error occurspublic TomcatManagerResponse reload(String path) throws TomcatManagerException, IOException
path
- the webapp context path to reloadTomcatManagerException
- if the Tomcat manager request failsIOException
- if an i/o error occurspublic TomcatManagerResponse start(String path) throws TomcatManagerException, IOException
path
- the webapp context path to startTomcatManagerException
- if the Tomcat manager request failsIOException
- if an i/o error occurspublic TomcatManagerResponse stop(String path) throws TomcatManagerException, IOException
path
- the webapp context path to stopTomcatManagerException
- if the Tomcat manager request failsIOException
- if an i/o error occurspublic TomcatManagerResponse list() throws TomcatManagerException, IOException
TomcatManagerException
- if the Tomcat manager request failsIOException
- if an i/o error occurspublic TomcatManagerResponse getServerInfo() throws TomcatManagerException, IOException
TomcatManagerException
- if the Tomcat manager request failsIOException
- if an i/o error occurspublic TomcatManagerResponse getResources() throws TomcatManagerException, IOException
TomcatManagerException
- if the Tomcat manager request failsIOException
- if an i/o error occurspublic TomcatManagerResponse getResources(String type) throws TomcatManagerException, IOException
type
- the class name of the resources to list, or null
for allTomcatManagerException
- if the Tomcat manager request failsIOException
- if an i/o error occurspublic TomcatManagerResponse getRoles() throws TomcatManagerException, IOException
TomcatManagerException
- if the Tomcat manager request failsIOException
- if an i/o error occurspublic TomcatManagerResponse getSessions(String path) throws TomcatManagerException, IOException
path
- the context path to list session information forTomcatManagerException
- if the Tomcat manager request failsIOException
- if an i/o error occursprotected TomcatManagerResponse invoke(String path) throws TomcatManagerException, IOException
path
- the Tomcat manager command to invokeTomcatManagerException
- if the Tomcat manager request failsIOException
- if an i/o error occursprotected TomcatManagerResponse invoke(String path, File data, long length) throws TomcatManagerException, IOException
path
- the Tomcat manager command to invokedata
- file to deployTomcatManagerException
- if the Tomcat manager request failsIOException
- if an i/o error occursprotected String calculateRelocatedUrl(org.apache.http.HttpResponse response)
Copyright © 2005–2014 The Apache Software Foundation. All rights reserved.