gretty {
// ...
contextConfigFile = 'someFile.xml'
// ...
}
"jetty-env.xml" is an optional Jetty file that configures individual web-app. The format of "jetty-env.xml" is the same as of "jetty.xml" - it is an XML mapping of the Jetty API.
The purpose and syntax of "jetty-env.xml" is documented at Jetty reference.
Gretty recognizes and supports "jetty-env.xml". As soon as Gretty finds existing "jetty-env.xml" file, it reads the file and uses it to configure jetty web-app. Even if "jetty-env.xml" is not found, Gretty still works.
You can (but you don’t have to) specify "jetty-env.xml" via property "contextConfigFile" in Gretty configuration:
gretty {
// ...
contextConfigFile = 'someFile.xml'
// ...
}
If explicitly defined contextConfigFile represents an absolute path, gretty will use just that.
If explicitly defined contextConfigFile represents a relative path, gretty tries to resolve it in the following directories:
"$project.projectDir/webapp-jetty"
"$project.projectDir/webapp-config"
recursively in the abovementioned folders of the overlay sources (if any)
If contextConfigFile is not specified, Gretty looks for one of the files: "jetty9-env.xml" (for Jetty 9), "jetty8-env.xml" (for Jetty 8), "jetty7-env.xml" (for Jetty 7), "jetty-env.xml" in the directory "$project.webAppDir/META-INF". Jetty version is defined by gretty.servletContainer property.
When you generate a product and "jetty-env.xml" resides within "$project.webAppDir/META-INF", it is packed into the WAR-file. The running product automatically finds and applies "META-INF/jetty-env.xml" of each included web-app.
When you generate a product and "jetty-env.xml" resides within "webapp-jetty" or "webapp-config", the file is copied to subdirectory "conf/$projectName" and referenced in "conf/server.json". The running product automatically applies "jetty-env.xml" files listed in "conf/server.json".
Gretty sources contain example programs demonstrating support of "jetty-env.xml" at work:
See also: