<?xml version="1.0"?>
<!--
    $Id$

    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at
   
         http://www.apache.org/licenses/LICENSE-2.0
   
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->

<document url="installation-jetty.html">

    <properties>
        <title>The Struts Framework Project - Installation - Jetty</title>
    </properties>

    <body>
        <section name="6.2 Installation" href="installation">
            <subsection name="Installing Struts with your servlet container"
                        href="Containers">

                <h4 id="jetty">Jetty Java HTTP Servlet Server</h4>

                <p>
                    Jetty is a small, pure-Java, open source HTTP server that
                    supports the
                    2.3 Servlet spec and JSP 1.2. Jetty can be downloaded from
                    <a href="http://www.mortbay.com/jetty">
                        http://www.mortbay.com/jetty</a>
                    .
                </p>

                <p>
                    Struts WAR files run nearly straight out of the box when
                    placed
                    underneath Jetty's webapps directory. The one additional
                    step needed
                    is to add an entry for each WAR file to the Jetty server
                    configuration
                    file in order to map the appropriate request paths to the
                    added Struts
                    web applications (using "&lt;Call name="addWebApplication"&gt;...").
                </p>

                <p>
                    So for example, if you have copied the WAR files that come
                    with the
                    Struts binary distribution into a subdirectory of the
                    "%JETTY_HOME%/webapps" called
                    "%JETTY_HOME%/webapps/struts" so that
                    you have:
                </p>

                <pre>
                    - %JETTY_HOME%/webapps/struts/struts-documentation.war
                    - %JETTY_HOME%/webapps/struts/struts-example.war
                    - %JETTY_HOME%/webapps/struts/struts-exercise-taglib.war
                    - %JETTY_HOME%/webapps/struts/struts-upload.war
                    - %JETTY_HOME%/webapps/struts/struts-blank.war
                </pre>

                <p>
                    And you want to run Jetty using the demo.xml configuration
                    file that
                    comes with Jetty, just add the following block to
                    demo.xml, anywhere
                    after the Listeners are declared.
                </p>

                <pre>
                    &lt;!-- Jetty config for Struts BEGIN --&gt;

                    &lt;Call name="addWebApplication"&gt;
                    &lt;Arg&gt;/struts/struts-documentation/*&lt;/Arg&gt;
                    &lt;Arg&gt;&lt;SystemProperty name="jetty.home"
                    default="."/&gt;/webapps/struts/struts-documentation.war&lt;/Arg&gt;
                    &lt;Arg&gt;&lt;SystemProperty name="jetty.home"
                    default="."/&gt;/etc/webdefault.xml&lt;/Arg&gt;
                    &lt;Arg type="boolean"&gt;false&lt;/Arg&gt; &lt;!-- if
                    true,
                    expand war in temp dir --&gt;
                    &lt;/Call&gt;

                    &lt;Call name="addWebApplication"&gt;
                    &lt;Arg&gt;/struts/struts-example/*&lt;/Arg&gt;
                    &lt;Arg&gt;&lt;SystemProperty name="jetty.home"
                    default="."/&gt;/webapps/struts/struts-example.war&lt;/Arg&gt;
                    &lt;Arg&gt;&lt;SystemProperty name="jetty.home"
                    default="."/&gt;/etc/webdefault.xml&lt;/Arg&gt;
                    &lt;Arg type="boolean"&gt;true&lt;/Arg&gt; &lt;!-- if
                    true,
                    expand war in temp dir --&gt;
                    &lt;/Call&gt;

                    &lt;Call name="addWebApplication"&gt;
                    &lt;Arg&gt;/struts/struts-exercise-taglib/*&lt;/Arg&gt;
                    &lt;Arg&gt;&lt;SystemProperty name="jetty.home"
                    default="."/&gt;/webapps/struts/struts-exercise-taglib.war&lt;/Arg&gt;
                    &lt;Arg&gt;&lt;SystemProperty name="jetty.home"
                    default="."/&gt;/etc/webdefault.xml&lt;/Arg&gt;
                    &lt;Arg type="boolean"&gt;false&lt;/Arg&gt; &lt;!-- if
                    true,
                    expand war in temp dir --&gt;
                    &lt;/Call&gt;

                    &lt;Call name="addWebApplication"&gt;
                    &lt;Arg&gt;/struts/struts-upload/*&lt;/Arg&gt;
                    &lt;Arg&gt;&lt;SystemProperty name="jetty.home"
                    default="."/&gt;/webapps/struts/struts-upload.war&lt;/Arg&gt;
                    &lt;Arg&gt;&lt;SystemProperty name="jetty.home"
                    default="."/&gt;/etc/webdefault.xml&lt;/Arg&gt;
                    &lt;Arg type="boolean"&gt;true&lt;/Arg&gt; &lt;!-- if
                    true,
                    expand war in temp dir --&gt;
                    &lt;/Call&gt;

                    &lt;Call name="addWebApplication"&gt;
                    &lt;Arg&gt;/struts/struts-blank/*&lt;/Arg&gt;
                    &lt;Arg&gt;&lt;SystemProperty name="jetty.home"
                    default="."/&gt;/webapps/struts/struts-blank.war&lt;/Arg&gt;
                    &lt;Arg&gt;&lt;SystemProperty name="jetty.home"
                    default="."/&gt;/etc/webdefault.xml&lt;/Arg&gt;
                    &lt;Arg type="boolean"&gt;true&lt;/Arg&gt; &lt;!-- if
                    true,
                    expand war in temp dir --&gt;
                    &lt;/Call&gt;

                    &lt;!-- Jetty config for Struts END --&gt;
                </pre>

                <hr/>
                <p>Back to
                    <a href="installation.html#Containers">Installation</a>
                </p>

            </subsection>
        </section>
    </body>
</document>
