Using JettyPlus

 

If you want to use JettyPlus, that supports things like JNDI datasources, JAAS, etc., you have to use a Jetty XML configuration file instead of the simple options.

In this file, the line:

<Configure class="org.mortbay.jetty.plus.Server">
should be used. This is all the Jetty plugin needs to know for starting JettyPlus instead of the 'normal' Jetty server.

Jetty plus should be installed as is default when you download a Jetty distribution. JettyPlus is then installed in directory ${jetty.installdir}/extra

You can check whether the Jetty plugin is using JettyPlus by looking at the XML configuration label:

 

Here is an example of a configuration file that uses JettyPlus:

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure 1.2//EN" "http://jetty.mortbay.org/configure_1_2.dtd">

<Configure class="org.mortbay.jetty.plus.Server">

  <Call name="addListener">
    <Arg>
      <New class="org.mortbay.http.SocketListener">
        <Set name="Port"><SystemProperty name="jetty.port" default="8080"/></Set>
        <Set name="MinThreads">10</Set>
        <Set name="MaxThreads">100</Set>
        <Set name="MaxIdleTimeMs">30000</Set>
        <Set name="LowResourcePersistTimeMs">5000</Set>
        <Set name="ConfidentialPort">8443</Set>
        <Set name="IntegralPort">8443</Set>
      </New>
    </Arg>
  </Call>

  <Call name="addService">
    <Arg>
      <New class="org.mortbay.jetty.plus.JotmService">
        <Call name="addDataSource">
             <Arg>jdbc/database</Arg>
             <Arg>
			   <New class="org.enhydra.jdbc.oracle.OracleXADataSource">
                 <Set name="DriverName">oracle.jdbc.OracleDriver</Set>
                 <Set name="Url">jdbc:oracle:thin:@myserver:1521:myschema</Set>
                 <Set name="User">MYUSER</Set>
                 <Set name="Password">MYPASSWORD</Set>
               </New>
             </Arg>
        </Call>
     </New>
   </Arg>
  </Call>

  <Call name="addWebApplication">
    <Arg>/mywebapp</Arg>
    <Arg>src/webapp</Arg>
  </Call>

</Configure>

see also Using jetty.xml files