SessionsTask (Apache Tomcat 9.0.120 API Documentation)
Description: declaration: package: org.apache.catalina.ant, class: SessionsTask

# Class SessionsTask

java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.catalina.ant.BaseRedirectorHelperTask
org.apache.catalina.ant.AbstractCatalinaTask
org.apache.catalina.ant.AbstractCatalinaCommandTask
org.apache.catalina.ant.SessionsTask

All Implemented Interfaces:
  `Cloneable`

public class SessionsTask extends AbstractCatalinaCommandTask
Ant task that implements the `/sessions` command supported by the Tomcat manager application.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected String`
  `idle`
  Minimum idle time in minutes for sessions to be included in the response.

  ### Fields inherited from class AbstractCatalinaCommandTask

  `path, version`

  ### Fields inherited from class AbstractCatalinaTask

  `charset, ignoreResponseConstraint, password, url, username`

  ### Fields inherited from class BaseRedirectorHelperTask

  `alwaysLog, failOnError, redirectErrStream, redirector, redirectorConfigured, redirectorElement, redirectOutput, redirectOutStream`

  ### Fields inherited from class org.apache.tools.ant.Task

  `target, taskName, taskType, wrapper`

  ### Fields inherited from class org.apache.tools.ant.ProjectComponent

  `description, location, project`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SessionsTask()`
  Default constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `StringBuilder`
  `createQueryString(String command)`
  Appends the idle parameter to the query string if both path and idle are set.
  `void`
  `execute()`
  Execute the specified command.
  `String`
  `getIdle()`
  Returns the minimum idle time in minutes for sessions to be included.
  `void`
  `setIdle(String idle)`
  Sets the minimum idle time in minutes for sessions to be included.

  ### Methods inherited from class AbstractCatalinaCommandTask

  `getPath, getVersion, setPath, setVersion`

  ### Methods inherited from class AbstractCatalinaTask

  `execute, execute, getCharset, getPassword, getUrl, getUsername, isIgnoreResponseConstraint, setCharset, setIgnoreResponseConstraint, setPassword, setUrl, setUsername`

  ### Methods inherited from class BaseRedirectorHelperTask

  `addConfiguredRedirector, closeRedirector, handleErrorFlush, handleErrorOutput, handleFlush, handleOutput, handleOutput, isFailOnError, openRedirector, setAlwaysLog, setAppend, setCreateEmptyFiles, setError, setErrorProperty, setFailonerror, setLogError, setOutput, setOutputproperty`

  ### Methods inherited from class org.apache.tools.ant.Task

  `bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleInput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType`

  ### Methods inherited from class org.apache.tools.ant.ProjectComponent

  `clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject`

  ### Methods inherited from class Object

  `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### idle

    protected String idle
    Minimum idle time in minutes for sessions to be included in the response.

- ## Constructor Details

  - ### SessionsTask

    public SessionsTask()
    Default constructor.

- ## Method Details

  - ### getIdle

    public String getIdle()
    Returns the minimum idle time in minutes for sessions to be included.
    Returns:
      the minimum idle time

  - ### setIdle

    public void setIdle(String idle)
    Sets the minimum idle time in minutes for sessions to be included.
    Parameters:
      `idle` - the minimum idle time

  - ### createQueryString

    public StringBuilder createQueryString(String command)
    Appends the idle parameter to the query string if both path and idle are set.
    Overrides:
      `createQueryString` in class `AbstractCatalinaCommandTask`
    Parameters:
      `command` - the command being executed
    Returns:
      the query string buffer

  - ### execute

    public void execute() throws org.apache.tools.ant.BuildException
    Description copied from class: `AbstractCatalinaTask`
    Execute the specified command. This logic only performs the common attribute validation required by all subclasses; it does not perform any functional logic directly.
    Overrides:
      `execute` in class `AbstractCatalinaTask`
    Throws:
      `org.apache.tools.ant.BuildException` - if a validation error occurs