Groovy Documentation

org.gradle.api.plugins.jetty
[Java] Class AbstractJettyRunTask

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

public abstract class AbstractJettyRunTask
extends ConventionTask

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


Field Summary
static String PORT_SYSPROPERTY

protected Thread consoleScanner

A scanner to check ENTER hits on the console.

protected String reload

protected List scannerListeners

List of Listeners for the scanner.

 
Method Summary
void applyJettyXml()

void configureScanner()

void configureWebApplication()

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

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 getAdditionalRuntimeJars()

Returns the classpath to make available to the web application.

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

RequestLog getRequestLog()

int getScanIntervalSeconds()

Returns the interval in seconds between scanning the web app for file changes.

Scanner getScanner()

List getScannerListeners()

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.

UserRealm[] getUserRealms()

JettyPluginWebAppContext getWebAppConfig()

File getWebDefaultXml()

boolean isDaemon()

Specifies whether the Jetty server should run in the background.

void restartWebApp(boolean reconfigureScanner)

void setAdditionalRuntimeJars(Iterable additionalRuntimeJars)

void setConnectors(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(RequestLog requestLog)

void setScanIntervalSeconds(int scanIntervalSeconds)

Sets the interval in seconds between scanning the web app for file changes.

void setScannerListeners(List listeners)

void setServer(JettyPluginServer server)

void setStopKey(String stopKey)

void setStopPort(Integer stopPort)

void setUserRealms(UserRealm[] userRealms)

void setWebAppConfig(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()

 

Field Detail

PORT_SYSPROPERTY

public static final String PORT_SYSPROPERTY


consoleScanner

protected Thread consoleScanner
A scanner to check ENTER hits on the console.


reload

protected String reload


scannerListeners

protected List scannerListeners
List of Listeners for the scanner.


 
Method Detail

applyJettyXml

public void applyJettyXml()


configureScanner

public void configureScanner()


configureWebApplication

public void configureWebApplication()
Subclasses should invoke this to setup basic info on the webapp.


createServer

public JettyPluginServer createServer()
create a proxy that wraps a particular jetty version Server object.
Returns:
The Jetty Plugin Server


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


finishConfigurationBeforeStart

public void finishConfigurationBeforeStart()


getAdditionalRuntimeJars

@InputFiles
public Iterable getAdditionalRuntimeJars()
Returns the classpath to make available to the web application.


getConnectors

public Connector[] getConnectors()


getContextPath

public String getContextPath()
Returns the context path to use to deploy the web application.


getHttpPort

public Integer getHttpPort()
Returns the TCP port for Jetty to listen on for incoming HTTP requests.


getJettyConfig

@InputFile
@Optional
public File getJettyConfig()
Returns the jetty configuration file to use. When null, no configuration file is used.


getOverrideWebXml

@InputFile
@Optional
public File getOverrideWebXml()


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.


getRequestLog

public RequestLog getRequestLog()


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.


getScanner

public Scanner getScanner()


getScannerListeners

public List getScannerListeners()


getServer

public JettyPluginServer getServer()


getStopKey

public String getStopKey()
Returns the key to use to stop Jetty.


getStopPort

public Integer getStopPort()
Returns the TCP port for Jetty to listen on for stop requests.


getUserRealms

public UserRealm[] getUserRealms()


getWebAppConfig

public JettyPluginWebAppContext getWebAppConfig()


getWebDefaultXml

@InputFile
@Optional
public File getWebDefaultXml()


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.


restartWebApp

public void restartWebApp(boolean reconfigureScanner)


setAdditionalRuntimeJars

public void setAdditionalRuntimeJars(Iterable additionalRuntimeJars)


setConnectors

public void setConnectors(Connector[] connectors)


setContextPath

public void setContextPath(String contextPath)


setDaemon

public void setDaemon(boolean daemon)


setHttpPort

public void setHttpPort(Integer httpPort)


setJettyConfig

public void setJettyConfig(File jettyConfig)


setOverrideWebXml

public void setOverrideWebXml(File overrideWebXml)


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.


setRequestLog

public void setRequestLog(RequestLog requestLog)


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.


setScannerListeners

public void setScannerListeners(List listeners)


setServer

public void setServer(JettyPluginServer server)


setStopKey

public void setStopKey(String stopKey)


setStopPort

public void setStopPort(Integer stopPort)


setUserRealms

public void setUserRealms(UserRealm[] userRealms)


setWebAppConfig

public void setWebAppConfig(JettyPluginWebAppContext webAppConfig)


setWebDefaultXml

public void setWebDefaultXml(File webDefaultXml)


start

@TaskAction
protected void start()


startConsoleScanner

protected void startConsoleScanner()
Run a thread that monitors the console input to detect ENTER hits.


startJetty

public void startJetty()


startJettyInternal

public void startJettyInternal()


validateConfiguration

public void validateConfiguration()


 

Gradle API 1.12