TomcatApplication

class tomcatmanager.models.TomcatApplication

Bases: object

Discrete data about an application running inside a Tomcat Server.

A list of these objects is returned by tomcatmanager.TomcatManager.list().

classmethod sort_by_state_by_path_by_version(app: TA)

Function to create a key usable by sort to sort by state, by path, by version.

classmethod sort_by_path_by_version_by_state(app: TA)

Function to create a key usable by sort to sort by path, by version, by state

parse(line: str)

Parse a line from the server into this object.

Param:line - the line of text from Tomcat Manager describing a deployed application

Tomcat Manager outputs a line like this for each application:

/shiny:running:0:shiny##v2.0.6

The data elements in this line can be described as:

{path}:{state}:{sessions}:{directory}##{version}

Where version and the two hash marks that precede it are optional.

path

The context path, or relative URL, where this app is available on the server.

state

The current state of the application.

tomcatmanager.application_states is a dictionary of all the valid values for this property. In addition to being a dictionary, it also has attributes for each possible state:

>>> import tomcatmanager as tm
>>> tm.application_states['stopped']
'stopped'
>>> tm.application_states.running
'running'
sessions

The number of currently active sessions.

directory

The directory on the server where this application resides.

version

The version of the application given when it was deployed.

If deployed without a version, this property returns None.

directory_and_version

Combine directory and version together.

Tomcat provides this information as {directory} if there was no version specified when the application was deployed, or {directory}##{version} if the version was specified.

This method has the logic to determine if version was specified or not.