<commit_before>tomcatmanager
=============

If you use Apache Tomcat for any sort of development work you’ve probably deployed lots of applications to it. There are a several ways to get your war files deployed:

- use the [Tomcat Manager](https://tomcat.apache.org/tomcat-8.5-doc/manager-howto.html) application in your browser
- use the [Tomcat Ant Tasks](https://wiki.apache.org/tomcat/AntDeploy) included with Tomcat
- use [Cargo](https://codehaus-cargo.github.io/) and its plugins for ant and maven

Here's another way. tomcatmanager is a command line tool and python
library for managing a Tomcat server.


Quick Tour
----------

This package installs a command line utility called `tomcat-manager`. It's easily scriptable using your favorite shell:

.. code-block:: bash

    $ tomcat-manager --user=ace --password=<PASSWORD> \
      http://localhost:8080/manager deploy local sample.war /sampleapp
    $ echo $?
    0

There is also an interactive mode:

.. code-block:: bash

    $ tomcat-manager
    tomcat-manager>connect http://localhost:8080/manager ace newenglandclamchowder
    tomcat-manager>list
    Path                     Status  Sessions Directory
    ------------------------ ------- -------- ------------------------------------
    /                        running        0 ROOT
    /sampleapp               stopped        0 sampleapp##9
    /sampleapp               running        0 sampleapp##8
    /host-manager            running        0 /usr/share/tomcat8-admin/host-manage
    /manager                 running        0 /usr/share/tomcat8-admin/manager

And for the ultimate in flexibility, you can use the python library directly:

>>> import tomcatmanager as tm
>>> tomcat = tm.TomcatManager(url='http://localhost:8080/manager',
... userid='ace', password='<PASSWORD>')
>>> tomcat.is_connected
True
>>> r = tomcat.stop('/')
>>> r.status_code == tm.codes.ok
False
>>> r.status_message
'No context exists named /sample'


Installation
------------

Install tomcatmanager using pip:

.. code-block:: bash

    $ pip install tomcatmanager


Tomcat Configuration
--------------------

This library and associated tools do their work via the Tomcat Manager
web application included in the Tomcat distribution. You will need to
configure authentication in `tomcat-users.xml` with access to the
`manager-script` role:

.. code-block: xml

    <tomcat-users>
    .....
        <role rolename="manager-script"/>
        <user username="ace" password="<PASSWORD>" roles="manager-script"/>
    </tomcat-users>


Features
--------

The tomcat-manager command line tool supports the following commands:

- **list** - show all applications currently installed
- **serverinfo** - show information about the server, including tomcat version, OS version and architecture, and jvm version
- **statusxml** - show server status information in XML format
- **vminfo** - show diagnostic information about the jvm
- **sslconnectorciphers** - get SSL/TLS ciphers configured for each connector
- **threaddump** - show a jvm thread dump
- **resources** - show the global jdni resources configured in tomcat
- **findleakers** - show tomcat apps that are leaking memory
- **sessions** - show active sessions for a particular tomcat application
- **expire** - expire idle sessions
- **start** - start a tomcat application that has already been deployed in the tomcat server
- **stop** - stop execution of a tomcat application but leave it deployed in the tomcat server
- **reload** - stop and start a tomcat application<commit_msg>fix typo<commit_after>tomcatmanager
=============

If you use Apache Tomcat for any sort of development work you’ve probably deployed lots of applications to it. There are a several ways to get your war files deployed:

- use the [Tomcat Manager](https://tomcat.apache.org/tomcat-8.5-doc/manager-howto.html) application in your browser
- use the [Tomcat Ant Tasks](https://wiki.apache.org/tomcat/AntDeploy) included with Tomcat
- use [Cargo](https://codehaus-cargo.github.io/) and its plugins for ant and maven

Here's another way. tomcatmanager is a command line tool and python
library for managing a Tomcat server.


Quick Tour
----------

This package installs a command line utility called `tomcat-manager`. It's easily scriptable using your favorite shell:

.. code-block:: bash

    $ tomcat-manager --user=ace --password=<PASSWORD>der \
      http://localhost:8080/manager deploy local sample.war /sampleapp
    $ echo $?
    0

There is also an interactive mode:

.. code-block:: bash

    $ tomcat-manager
    tomcat-manager>connect http://localhost:8080/manager ace newenglandclamchowder
    tomcat-manager>list
    Path                     Status  Sessions Directory
    ------------------------ ------- -------- ------------------------------------
    /                        running        0 ROOT
    /sampleapp               stopped        0 sampleapp##9
    /sampleapp               running        0 sampleapp##8
    /host-manager            running        0 /usr/share/tomcat8-admin/host-manage
    /manager                 running        0 /usr/share/tomcat8-admin/manager

And for the ultimate in flexibility, you can use the python library directly:

>>> import tomcatmanager as tm
>>> tomcat = tm.TomcatManager(url='http://localhost:8080/manager',
... userid='ace', password='<PASSWORD>')
>>> tomcat.is_connected
True
>>> r = tomcat.stop('/')
>>> r.status_code == tm.codes.ok
False
>>> r.status_message
'No context exists named /sample'


Installation
------------

Install tomcatmanager using pip:

.. code-block:: bash

    $ pip install tomcatmanager


Tomcat Configuration
--------------------

This library and associated tools do their work via the Tomcat Manager
web application included in the Tomcat distribution. You will need to
configure authentication in `tomcat-users.xml` with access to the
`manager-script` role:

.. code-block:: xml

    <tomcat-users>
    .....
        <role rolename="manager-script"/>
        <user username="ace" password="<PASSWORD>" roles="manager-script"/>
    </tomcat-users>


Features
--------

The tomcat-manager command line tool supports the following commands:

- **list** - show all applications currently installed
- **serverinfo** - show information about the server, including tomcat version, OS version and architecture, and jvm version
- **statusxml** - show server status information in XML format
- **vminfo** - show diagnostic information about the jvm
- **sslconnectorciphers** - get SSL/TLS ciphers configured for each connector
- **threaddump** - show a jvm thread dump
- **resources** - show the global jdni resources configured in tomcat
- **findleakers** - show tomcat apps that are leaking memory
- **sessions** - show active sessions for a particular tomcat application
- **expire** - expire idle sessions
- **start** - start a tomcat application that has already been deployed in the tomcat server
- **stop** - stop execution of a tomcat application but leave it deployed in the tomcat server
- **reload** - stop and start a tomcat application
{'fraction_non_alphanumeric': 0.129794762915782, 'fraction_numerical': 0.006794055201698514, 'mean_word_length': 2.8071120689655173, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 57, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4382889', 'n_tokens_mistral': 1882, 'n_tokens_neox': 1823, 'n_words': 712}