Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Jetty/Howto/Configure Jetty"
m |
m (→Using Jetty XML) |
||
Line 35: | Line 35: | ||
* a request log | * a request log | ||
− | Not all | + | Not all Jetty features are configured in <tt>jetty.xml</tt>. There are several optional configuration files that share the same format as <tt>jetty.xml</tt> and, if specified, concatenate to it. These configuration files are also stored in <tt>$JETTY_HOME/etc/</tt>, and examples of them are in [http://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk/jetty-server/src/main/config/etc/ svn]. [[Jetty/Feature/Start.jar|start.jar]] selects the configuration files to use. [[Jetty/Reference/jetty.xml_usage|jetty.xml usage]] describes the process of merging configuration files. |
With [http://wiki.eclipse.org/Jetty/Reference/jetty.xml_usage Jetty XML] - dependency injection style XML format. | With [http://wiki.eclipse.org/Jetty/Reference/jetty.xml_usage Jetty XML] - dependency injection style XML format. |
Revision as of 20:20, 11 August 2010
Contents
Introduction
Configuring jetty consists of building a network of connectors and handlers and providing their individual configurations. It is a combination of
- HTTP server configuration (ports, thread pools, buffers, etc.)
- Web container configuration (webapps deployment, security realms, JNDI etc.)
- Web application (init parameters, non standard options, etc.)
See Jetty Architecture for a graphical representation of the interactions among connectors and handlers.
Configuring Jetty
Since Jetty components are simply Plain Old Java Objects (POJOs), you can accomplish this assembly and configuration of Jetty by a variety of techniques:
#Using Your Favorite Dependency Injection Framework: Spring, XBean
#Using Jetty WebApp and Context Deployers
In Code
See the examples in the Jetty 7 Latest Source XRef.
Using Jetty XML
The default configuration file for Jetty is jetty.xml, typically located at $JETTY_HOME/etc/jetty.xml. Usually jetty.xml configures these components:
- the Server class (or subclass if extended) and global options
- a ThreadPool (min & max thread)
- connectors (ports, timeouts, buffer sizes, protocol, etc.)
- the handler structure (default handlers and/or a contextHandlerCollections, etc.)
- the deployment manager that scans for and deploys webapps and contexts
- login services that provide authentication checking.
- a request log
Not all Jetty features are configured in jetty.xml. There are several optional configuration files that share the same format as jetty.xml and, if specified, concatenate to it. These configuration files are also stored in $JETTY_HOME/etc/, and examples of them are in svn. start.jar selects the configuration files to use. jetty.xml usage describes the process of merging configuration files.
With Jetty XML - dependency injection style XML format. Jetty XML used with jetty.xml and other files
Embedding Jetty
Using the Jetty Maven Plugin
Using Your Favorite Dependency Injection Framework: Spring, XBean
Configuring Jetty with Spring
Configuring Jetty with XBean
Using Jetty WebApp and Context Deployers
More
For more configuration references, see the Jetty Configuration Reference pages.
Finally
Because Jetty configuration can be considered as calling setters on a collection of POJOs, regardless of the actual method used, the apidocs are the ultimate resource for configuration.