Package: org.gradle.api.plugins.jetty

## [Java] Class AbstractJettyRunTask

- org.gradle.api.plugins.jetty.AbstractJettyRunTask

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

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static String` | `PORT_SYSPROPERTY` |
    `protected Thread` | `consoleScanner` | A scanner to check ENTER hits on the console.
    `protected String` | `reload` |
    `protected List<Scanner.Listener>` | `scannerListeners` | List of Listeners for the scanner.

  - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class org.gradle.api.internal.ConventionTask` | `TASK_NAME, TASK_DESCRIPTION, TASK_GROUP, TASK_TYPE, TASK_DEPENDS_ON, TASK_OVERWRITE, TASK_ACTION`
    `class DefaultTask` | `TASK_NAME, TASK_DESCRIPTION, TASK_GROUP, TASK_TYPE, TASK_DEPENDS_ON, TASK_OVERWRITE, TASK_ACTION`

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `void` | `applyJettyXml()`
    `void` | `configureScanner()`
    `void` | `configureWebApplication()` Subclasses should invoke this to setup basic info on the webapp.
    `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.
    `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<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.
    `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<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()`
    `void` | `validateConfiguration()`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class org.gradle.api.internal.ConventionTask` | `org.gradle.api.internal.ConventionTask#conventionMapping(java.lang.String, groovy.lang.Closure), org.gradle.api.internal.ConventionTask#conventionMapping(java.lang.String, java.util.concurrent.Callable), org.gradle.api.internal.ConventionTask#getConventionMapping(), org.gradle.api.internal.ConventionTask#setProperty(java.lang.String, java.lang.Object), org.gradle.api.internal.ConventionTask#toString(), org.gradle.api.internal.ConventionTask#compareTo(org.gradle.api.Task), org.gradle.api.internal.ConventionTask#compareTo(java.lang.Object), org.gradle.api.internal.ConventionTask#getName(), org.gradle.api.internal.ConventionTask#getActions(), org.gradle.api.internal.ConventionTask#setName(java.lang.String), org.gradle.api.internal.ConventionTask#getState(), org.gradle.api.internal.ConventionTask#getState(), org.gradle.api.internal.ConventionTask#getPath(), org.gradle.api.internal.ConventionTask#getExtensions(), org.gradle.api.internal.ConventionTask#getLogger(), org.gradle.api.internal.ConventionTask#execute(), org.gradle.api.internal.ConventionTask#configure(groovy.lang.Closure), org.gradle.api.internal.ConventionTask#configure(groovy.lang.Closure), org.gradle.api.internal.ConventionTask#getDescription(), org.gradle.api.internal.ConventionTask#leftShift(groovy.lang.Closure), org.gradle.api.internal.ConventionTask#property(java.lang.String), org.gradle.api.internal.ConventionTask#isEnabled(), org.gradle.api.internal.ConventionTask#setEnabled(boolean), org.gradle.api.internal.ConventionTask#getOutputs(), org.gradle.api.internal.ConventionTask#getOutputs(), org.gradle.api.internal.ConventionTask#onlyIf(org.gradle.api.specs.Spec), org.gradle.api.internal.ConventionTask#onlyIf(groovy.lang.Closure), org.gradle.api.internal.ConventionTask#setOnlyIf(org.gradle.api.specs.Spec), org.gradle.api.internal.ConventionTask#setOnlyIf(groovy.lang.Closure), org.gradle.api.internal.ConventionTask#setDidWork(boolean), org.gradle.api.internal.ConventionTask#getDidWork(), org.gradle.api.internal.ConventionTask#doFirst(org.gradle.api.Action), org.gradle.api.internal.ConventionTask#doFirst(groovy.lang.Closure), org.gradle.api.internal.ConventionTask#doLast(org.gradle.api.Action), org.gradle.api.internal.ConventionTask#doLast(groovy.lang.Closure), org.gradle.api.internal.ConventionTask#deleteAllActions(), org.gradle.api.internal.ConventionTask#getEnabled(), org.gradle.api.internal.ConventionTask#getAnt(), org.gradle.api.internal.ConventionTask#getLogging(), org.gradle.api.internal.ConventionTask#getLogging(), org.gradle.api.internal.ConventionTask#hasProperty(java.lang.String), org.gradle.api.internal.ConventionTask#getConvention(), org.gradle.api.internal.ConventionTask#setDescription(java.lang.String), org.gradle.api.internal.ConventionTask#getGroup(), org.gradle.api.internal.ConventionTask#setGroup(java.lang.String), org.gradle.api.internal.ConventionTask#getTaskDependencies(), org.gradle.api.internal.ConventionTask#getTaskDependencies(), org.gradle.api.internal.ConventionTask#setDependsOn(java.lang.Iterable), org.gradle.api.internal.ConventionTask#dependsOn([Ljava.lang.Object;), org.gradle.api.internal.ConventionTask#getProject(), org.gradle.api.internal.ConventionTask#setActions(java.util.List), org.gradle.api.internal.ConventionTask#getDependsOn(), org.gradle.api.internal.ConventionTask#dependsOnTaskDidWork(), org.gradle.api.internal.ConventionTask#getInputs(), org.gradle.api.internal.ConventionTask#getTemporaryDir(), org.gradle.api.internal.ConventionTask#mustRunAfter([Ljava.lang.Object;), org.gradle.api.internal.ConventionTask#setMustRunAfter(java.lang.Iterable), org.gradle.api.internal.ConventionTask#getMustRunAfter(), org.gradle.api.internal.ConventionTask#finalizedBy([Ljava.lang.Object;), org.gradle.api.internal.ConventionTask#setFinalizedBy(java.lang.Iterable), org.gradle.api.internal.ConventionTask#getFinalizedBy(), org.gradle.api.internal.ConventionTask#shouldRunAfter([Ljava.lang.Object;), org.gradle.api.internal.ConventionTask#setShouldRunAfter(java.lang.Iterable), org.gradle.api.internal.ConventionTask#getShouldRunAfter(), org.gradle.api.internal.ConventionTask#getStandardOutputCapture(), org.gradle.api.internal.ConventionTask#getAsDynamicObject(), org.gradle.api.internal.ConventionTask#setProject(org.gradle.api.Project), org.gradle.api.internal.ConventionTask#injectIntoNewInstance(org.gradle.api.internal.project.ProjectInternal, java.lang.String, java.lang.Class, java.util.concurrent.Callable), org.gradle.api.internal.ConventionTask#prependParallelSafeAction(org.gradle.api.Action), org.gradle.api.internal.ConventionTask#getOnlyIf(), org.gradle.api.internal.ConventionTask#getImpliesSubProjects(), org.gradle.api.internal.ConventionTask#setImpliesSubProjects(boolean), org.gradle.api.internal.ConventionTask#getExecuter(), org.gradle.api.internal.ConventionTask#setExecuter(org.gradle.api.internal.tasks.TaskExecuter), org.gradle.api.internal.ConventionTask#getTemporaryDirFactory(), org.gradle.api.internal.ConventionTask#addValidator(org.gradle.api.internal.tasks.execution.TaskValidator), org.gradle.api.internal.ConventionTask#getValidators(), org.gradle.api.internal.ConventionTask#appendParallelSafeAction(org.gradle.api.Action), org.gradle.api.internal.ConventionTask#isHasCustomActions(), org.gradle.api.internal.ConventionTask#getTaskActions(), org.gradle.api.internal.ConventionTask#wait(long, int), org.gradle.api.internal.ConventionTask#wait(long), org.gradle.api.internal.ConventionTask#wait(), org.gradle.api.internal.ConventionTask#equals(java.lang.Object), org.gradle.api.internal.ConventionTask#hashCode(), org.gradle.api.internal.ConventionTask#getClass(), org.gradle.api.internal.ConventionTask#notify(), org.gradle.api.internal.ConventionTask#notifyAll()`
    `class DefaultTask` | `setProperty, toString, compareTo, compareTo, getName, getActions, setName, getState, getState, getPath, getExtensions, getLogger, execute, configure, configure, getDescription, leftShift, property, isEnabled, setEnabled, getOutputs, getOutputs, onlyIf, onlyIf, setOnlyIf, setOnlyIf, setDidWork, getDidWork, doFirst, doFirst, doLast, doLast, deleteAllActions, getEnabled, getAnt, getLogging, getLogging, hasProperty, getConvention, setDescription, getGroup, setGroup, getTaskDependencies, getTaskDependencies, setDependsOn, dependsOn, getProject, setActions, getDependsOn, dependsOnTaskDidWork, getInputs, getTemporaryDir, mustRunAfter, setMustRunAfter, getMustRunAfter, finalizedBy, setFinalizedBy, getFinalizedBy, shouldRunAfter, setShouldRunAfter, getShouldRunAfter, getStandardOutputCapture, getAsDynamicObject, setProject, injectIntoNewInstance, prependParallelSafeAction, getOnlyIf, getImpliesSubProjects, setImpliesSubProjects, getExecuter, setExecuter, getTemporaryDirFactory, addValidator, getValidators, appendParallelSafeAction, isHasCustomActions, getTaskActions, wait, wait, wait, equals, hashCode, getClass, notify, notifyAll`

- - ### Field Detail

    - #### public static final String PORT_SYSPROPERTY

    - #### protected Thread consoleScanner

      A scanner to check ENTER hits on the console.

    - #### protected String reload

    - #### protected List<Scanner.Listener> scannerListeners

      List of Listeners for the scanner.

  - ### Method Detail

    - #### public void applyJettyXml()

    - #### public void configureScanner()

    - #### public void configureWebApplication()

      Subclasses should invoke this to setup basic info on the webapp.

    - #### public org.gradle.api.plugins.jetty.internal.JettyPluginServer createServer()

      create a proxy that wraps a particular jetty version Server object.

      Returns:
        The Jetty Plugin Server

    - #### 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

    - #### public void finishConfigurationBeforeStart()

    - #### @InputFiles public Iterable<File> getAdditionalRuntimeJars()

      Returns the classpath to make available to the web application.

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

    - #### public String getContextPath()

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

    - #### public Integer getHttpPort()

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

    - #### @InputFile @Optional public File getJettyConfig()

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

    - #### @InputFile @Optional public File getOverrideWebXml()

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

    - #### public org.mortbay.jetty.RequestLog getRequestLog()

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

    - #### public org.mortbay.util.Scanner getScanner()

    - #### public List<Scanner.Listener> getScannerListeners()

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

    - #### public String getStopKey()

      Returns the key to use to stop Jetty.

    - #### public Integer getStopPort()

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

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

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

    - #### @InputFile @Optional public File getWebDefaultXml()

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

    - #### public void restartWebApp(boolean reconfigureScanner)

    - #### public void setAdditionalRuntimeJars(Iterable<File> additionalRuntimeJars)

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

    - #### public void setContextPath(String contextPath)

    - #### public void setDaemon(boolean daemon)

    - #### public void setHttpPort(Integer httpPort)

    - #### public void setJettyConfig(File jettyConfig)

    - #### public void setOverrideWebXml(File overrideWebXml)

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

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

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

    - #### public void setScannerListeners(List<Scanner.Listener> listeners)

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

    - #### public void setStopKey(String stopKey)

    - #### public void setStopPort(Integer stopPort)

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

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

    - #### public void setWebDefaultXml(File webDefaultXml)

    - #### @TaskAction protected void start()

    - #### protected void startConsoleScanner()

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

    - #### public void startJetty()

    - #### public void startJettyInternal()

    - #### public void validateConfiguration()