[Index]

web:server


An HTTP server.

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:


Property Summary

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 Summary

Example 1 Using Basic Authentication.

Property Detail

beans

Configured ByELEMENT
AccessREAD_WRITE
RequiredNo.

Provide Beans directly to the Jetty Server for management by Jetty. Currently untested.

handler

Configured ByELEMENT
AccessREAD_WRITE
RequiredNo, but pointless if missing.

The Jetty Handler. To provide a list of handlers that will be tried in order use web:handlers.

modifiers

Configured ByELEMENT
AccessWRITE_ONLY
RequiredNo.

Things that modify the server.

name

Configured ByATTRIBUTE
AccessREAD_WRITE
RequiredNo.

The name of service. Can be any text.

port

Configured ByATTRIBUTE
AccessREAD_WRITE
RequiredNo, uses a random available port.

The port number the server listens on.


Examples

Example 1

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>


(c) R Gordon Ltd 2005 - Present