TomcatApplication

class tomcatmanager.models.TomcatApplication

Discrete data about an application running inside a Tomcat Server.

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

classmethod sort_by_state_by_path_by_version(app: TomcatApplication)

Create a key usable by sort to sort by state, by path, by version.

classmethod sort_by_path_by_version_by_state(app: TomcatApplication)

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.

property path

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

property state

The current state of the application.

tomcatmanager.ApplicationState is an enum of the values for this property.

>>> import tomcatmanager as tm
>>> tm.ApplicationState.STOPPED
<ApplicationState.STOPPED: 'stopped'>
>>> tm.ApplicationState.RUNNING
<ApplicationState.RUNNING: 'running'>
property sessions

The number of currently active sessions.

property directory

The directory on the server where this application resides.

property version

The version of the application given when it was deployed.

If deployed without a version, this property returns None.

property 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.