This is a wrapper around the Jetty Server. The handlers property must be used to configure the server to do anything useful. By default a simple welcome message is returned for all requests.
Common handlers to use are:
beans | Provide Beans directly to the Jetty Server for management by Jetty. |
handler | The Jetty Handler. |
modifiers | Things that modify the server. |
name | The name of service. |
port | The port number the server listens on. |
Example 1 | Using Basic Authentication. |
Configured By | ELEMENT |
Access | READ_WRITE |
Required | No. |
Provide Beans directly to the Jetty Server for management by Jetty. Currently untested.
Configured By | ELEMENT |
Access | READ_WRITE |
Required | No, but pointless if missing. |
The Jetty Handler. To provide a list of handlers that will be tried in order use web:handlers.
Configured By | ELEMENT |
Access | WRITE_ONLY |
Required | No. |
Things that modify the server.
Configured By | ATTRIBUTE |
Access | READ_WRITE |
Required | No. |
The name of service. Can be any text.
Configured By | ATTRIBUTE |
Access | READ_WRITE |
Required | No, uses a random available port. |
The port number the server listens on.
Using Basic Authentication.
<oddjob id="oddjob"> <job> <web:server id="server" port="${server.port}" xmlns:web="oddjob:web"> <handler> <bean class="org.eclipse.jetty.security.ConstraintSecurityHandler"> <loginService> <bean class="org.eclipse.jetty.security.HashLoginService" name="FooRealm" config="${oddjob.dir}/realm.txt" hotReload="false"/> </loginService> <constraintMappings> <list> <values> <bean class="org.eclipse.jetty.security.ConstraintMapping" pathSpec="/*"> <constraint> <bean class="org.eclipse.jetty.util.security.Constraint" name="auth" authenticate="true"> <roles> <value value="**"/> </roles> </bean> </constraint> </bean> </values> </list> </constraintMappings> <authenticator> <bean class="org.eclipse.jetty.security.authentication.BasicAuthenticator"/> </authenticator> <handler> <bean class="org.oddjob.jetty.EchoRequestHandler"/> </handler> </bean> </handler> </web:server> </job> </oddjob>