org.gradle.api.plugins.jetty

## Class AbstractJettyRunTask

- java.lang.Object
- - org.gradle.api.internal.AbstractTask
  - - org.gradle.api.DefaultTask
    - - org.gradle.api.internal.ConventionTask
      - - org.gradle.api.plugins.jetty.AbstractJettyRunTask

- All Implemented Interfaces:
    Comparable<Task>, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.IConventionAware, org.gradle.api.internal.TaskInternal, ExtensionAware, Task, org.gradle.util.Configurable<Task>
  Direct Known Subclasses:
    JettyRun, JettyRunWar

      public abstract class AbstractJettyRunTask
      extends org.gradle.api.internal.ConventionTask

  Base class for all tasks which deploy a web application to an embedded Jetty web container.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.gradle.api.Task

      `Task.Namer`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Thread` | `consoleScanner` A scanner to check ENTER hits on the console.
    `static String` | `PORT_SYSPROPERTY`
    `protected String` | `reload`
    `protected List<org.mortbay.util.Scanner.Listener>` | `scannerListeners` List of Listeners for the scanner.

    - ### Fields inherited from interface org.gradle.api.Task

      `TASK_ACTION, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractJettyRunTask()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract void` | `applyJettyXml()`
    `abstract void` | `configureScanner()`
    `void` | `configureWebApplication()` Subclasses should invoke this to setup basic info on the webapp.
    `abstract org.gradle.api.plugins.jetty.internal.JettyPluginServer` | `createServer()` create a proxy that wraps a particular jetty version Server object.
    `File` | `findJettyWebXmlFile(File webInfDir)` Try and find a jetty-web.xml file, using some historical naming conventions if necessary.
    `abstract void` | `finishConfigurationBeforeStart()`
    `Iterable<File>` | `getAdditionalRuntimeJars()` Returns the classpath to make available to the web application.
    `org.mortbay.jetty.Connector[]` | `getConnectors()`
    `String` | `getContextPath()` Returns the context path to use to deploy the web application.
    `Integer` | `getHttpPort()` Returns the TCP port for Jetty to listen on for incoming HTTP requests.
    `File` | `getJettyConfig()` Returns the jetty configuration file to use.
    `File` | `getOverrideWebXml()`
    `String` | `getReload()` Returns the reload mode, which is either `"automatic"` or `"manual"`.
    `org.mortbay.jetty.RequestLog` | `getRequestLog()`
    `int` | `getScanIntervalSeconds()` Returns the interval in seconds between scanning the web app for file changes.
    `org.mortbay.util.Scanner` | `getScanner()`
    `List<org.mortbay.util.Scanner.Listener>` | `getScannerListeners()`
    `org.gradle.api.plugins.jetty.internal.JettyPluginServer` | `getServer()`
    `String` | `getStopKey()` Returns the key to use to stop Jetty.
    `Integer` | `getStopPort()` Returns the TCP port for Jetty to listen on for stop requests.
    `org.mortbay.jetty.security.UserRealm[]` | `getUserRealms()`
    `org.gradle.api.plugins.jetty.internal.JettyPluginWebAppContext` | `getWebAppConfig()`
    `File` | `getWebDefaultXml()`
    `boolean` | `isDaemon()` Specifies whether the Jetty server should run in the background.
    `abstract void` | `restartWebApp(boolean reconfigureScanner)`
    `void` | `setAdditionalRuntimeJars(Iterable<File> additionalRuntimeJars)`
    `void` | `setConnectors(org.mortbay.jetty.Connector[] connectors)`
    `void` | `setContextPath(String contextPath)`
    `void` | `setDaemon(boolean daemon)`
    `void` | `setHttpPort(Integer httpPort)`
    `void` | `setJettyConfig(File jettyConfig)`
    `void` | `setOverrideWebXml(File overrideWebXml)`
    `void` | `setReload(String reload)` Sets the reload mode, which is either `"automatic"` or `"manual"`.
    `void` | `setRequestLog(org.mortbay.jetty.RequestLog requestLog)`
    `void` | `setScanIntervalSeconds(int scanIntervalSeconds)` Sets the interval in seconds between scanning the web app for file changes.
    `void` | `setScannerListeners(List<org.mortbay.util.Scanner.Listener> listeners)`
    `void` | `setServer(org.gradle.api.plugins.jetty.internal.JettyPluginServer server)`
    `void` | `setStopKey(String stopKey)`
    `void` | `setStopPort(Integer stopPort)`
    `void` | `setUserRealms(org.mortbay.jetty.security.UserRealm[] userRealms)`
    `void` | `setWebAppConfig(org.gradle.api.plugins.jetty.internal.JettyPluginWebAppContext webAppConfig)`
    `void` | `setWebDefaultXml(File webDefaultXml)`
    `protected void` | `start()`
    `protected void` | `startConsoleScanner()` Run a thread that monitors the console input to detect ENTER hits.
    `void` | `startJetty()`
    `void` | `startJettyInternal()`
    `abstract void` | `validateConfiguration()`

    - ### Methods inherited from class org.gradle.api.internal.ConventionTask

      `conventionMapping, conventionMapping, getConventionMapping`

    - ### Methods inherited from class org.gradle.api.internal.AbstractTask

      `addValidator, compareTo, configure, deleteAllActions, dependsOn, dependsOnTaskDidWork, doFirst, doFirst, doLast, doLast, execute, executeWithoutThrowingTaskFailure, finalizedBy, getActions, getAnt, getAsDynamicObject, getConvention, getDependsOn, getDescription, getDidWork, getEnabled, getExecuter, getExtensions, getFinalizedBy, getGroup, getImpliesSubProjects, getInputs, getLogger, getLogging, getMustRunAfter, getName, getOnlyIf, getOutputs, getPath, getProject, getServices, getShouldRunAfter, getStandardOutputCapture, getState, getTaskActions, getTaskDependencies, getTemporaryDir, getTemporaryDirFactory, getValidators, hasProperty, injectIntoNewInstance, isEnabled, leftShift, mustRunAfter, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setExecuter, setFinalizedBy, setGroup, setImpliesSubProjects, setMustRunAfter, setName, setOnlyIf, setOnlyIf, setProject, setProperty, setShouldRunAfter, shouldRunAfter, toString`

    - ### Methods inherited from class java.lang.Object

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

- - ### Field Detail

    - #### reload

          protected String reload

    - #### scannerListeners

          protected List<org.mortbay.util.Scanner.Listener> scannerListeners

      List of Listeners for the scanner.

    - #### consoleScanner

          protected Thread consoleScanner

      A scanner to check ENTER hits on the console.

    - #### PORT_SYSPROPERTY

          public static final String PORT_SYSPROPERTY

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### AbstractJettyRunTask

          public AbstractJettyRunTask()

  - ### Method Detail

    - #### validateConfiguration

          public abstract void validateConfiguration()

    - #### configureScanner

          public abstract void configureScanner()

    - #### applyJettyXml

          public abstract void applyJettyXml()
                                      throws Exception

      Throws:
        `Exception`

    - #### createServer

          public abstract org.gradle.api.plugins.jetty.internal.JettyPluginServer createServer()
                                                                                        throws Exception

      create a proxy that wraps a particular jetty version Server object.
      Returns:
        The Jetty Plugin Server
      Throws:
        `Exception`

    - #### finishConfigurationBeforeStart

          public abstract void finishConfigurationBeforeStart()
                                                       throws Exception

      Throws:
        `Exception`

    - #### start

          protected void start()

    - #### getServer

          public org.gradle.api.plugins.jetty.internal.JettyPluginServer getServer()

    - #### setServer

          public void setServer(org.gradle.api.plugins.jetty.internal.JettyPluginServer server)

    - #### setScannerListeners

          public void setScannerListeners(List<org.mortbay.util.Scanner.Listener> listeners)

    - #### getScannerListeners

          public List<org.mortbay.util.Scanner.Listener> getScannerListeners()

    - #### getScanner

          public org.mortbay.util.Scanner getScanner()

    - #### startJetty

          public void startJetty()

    - #### startJettyInternal

          public void startJettyInternal()

    - #### restartWebApp

          public abstract void restartWebApp(boolean reconfigureScanner)
                                      throws Exception

      Throws:
        `Exception`

    - #### configureWebApplication

          public void configureWebApplication()
                                       throws Exception

      Subclasses should invoke this to setup basic info on the webapp.
      Throws:
        `Exception`

    - #### startConsoleScanner

          protected void startConsoleScanner()

      Run a thread that monitors the console input to detect ENTER hits.

    - #### findJettyWebXmlFile

          public File findJettyWebXmlFile(File webInfDir)

      Try and find a jetty-web.xml file, using some historical naming conventions if necessary.
      Returns:
        File object to the location of the jetty-web.xml

    - #### getWebDefaultXml

          @InputFile
          @Optional
          public File getWebDefaultXml()

    - #### setWebDefaultXml

          public void setWebDefaultXml(File webDefaultXml)

    - #### getOverrideWebXml

          @InputFile
          @Optional
          public File getOverrideWebXml()

    - #### setOverrideWebXml

          public void setOverrideWebXml(File overrideWebXml)

    - #### getScanIntervalSeconds

          public int getScanIntervalSeconds()

      Returns the interval in seconds between scanning the web app for file changes. If file changes are detected, the web app is reloaded. Only relevant if `reload` is set to `"automatic"`. Defaults to `0`, which disables automatic reloading.

    - #### setScanIntervalSeconds

          public void setScanIntervalSeconds(int scanIntervalSeconds)

      Sets the interval in seconds between scanning the web app for file changes. If file changes are detected, the web app is reloaded. Only relevant if `reload` is set to `"automatic"`. Defaults to `0`, which disables automatic reloading.

    - #### getContextPath

          public String getContextPath()

      Returns the context path to use to deploy the web application.

    - #### setContextPath

          public void setContextPath(String contextPath)

    - #### getWebAppConfig

          public org.gradle.api.plugins.jetty.internal.JettyPluginWebAppContext getWebAppConfig()

    - #### setWebAppConfig

          public void setWebAppConfig(org.gradle.api.plugins.jetty.internal.JettyPluginWebAppContext webAppConfig)

    - #### getReload

          public String getReload()

      Returns the reload mode, which is either `"automatic"` or `"manual"`.

      In automatic mode, the web app is scanned for file changes every n seconds, where n is determined by the `scanIntervalSeconds` property. (Note that `scanIntervalSeconds` defaults to `0`, which disables automatic reloading.) If files changes are detected, the web app is reloaded.

      In manual mode, the web app is reloaded whenever the Enter key is pressed.

    - #### setReload

          public void setReload(String reload)

      Sets the reload mode, which is either `"automatic"` or `"manual"`.

      In automatic mode, the web app is scanned for file changes every n seconds, where n is determined by the `scanIntervalSeconds` property. (Note that `scanIntervalSeconds` defaults to `0`, which disables automatic reloading.) If files changes are detected, the web app is reloaded.

      In manual mode, the web app is reloaded whenever the Enter key is pressed.

    - #### getJettyConfig

          @InputFile
          @Optional
          public File getJettyConfig()

      Returns the jetty configuration file to use. When `null`, no configuration file is used.

    - #### setJettyConfig

          public void setJettyConfig(File jettyConfig)

    - #### getStopPort

          public Integer getStopPort()

      Returns the TCP port for Jetty to listen on for stop requests.

    - #### setStopPort

          public void setStopPort(Integer stopPort)

    - #### getStopKey

          public String getStopKey()

      Returns the key to use to stop Jetty.

    - #### setStopKey

          public void setStopKey(String stopKey)

    - #### isDaemon

          public boolean isDaemon()

      Specifies whether the Jetty server should run in the background. When `true`, this task completes as soon as the server has started. When `false`, this task blocks until the Jetty server is stopped.

    - #### setDaemon

          public void setDaemon(boolean daemon)

    - #### getHttpPort

          public Integer getHttpPort()

      Returns the TCP port for Jetty to listen on for incoming HTTP requests.

    - #### setHttpPort

          public void setHttpPort(Integer httpPort)

    - #### getConnectors

          public org.mortbay.jetty.Connector[] getConnectors()

    - #### setConnectors

          public void setConnectors(org.mortbay.jetty.Connector[] connectors)

    - #### getUserRealms

          public org.mortbay.jetty.security.UserRealm[] getUserRealms()

    - #### setUserRealms

          public void setUserRealms(org.mortbay.jetty.security.UserRealm[] userRealms)

    - #### getRequestLog

          public org.mortbay.jetty.RequestLog getRequestLog()

    - #### setRequestLog

          public void setRequestLog(org.mortbay.jetty.RequestLog requestLog)

    - #### getAdditionalRuntimeJars

          @InputFiles
          public Iterable<File> getAdditionalRuntimeJars()

      Returns the classpath to make available to the web application.

    - #### setAdditionalRuntimeJars

          public void setAdditionalRuntimeJars(Iterable<File> additionalRuntimeJars)