Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This element is used to specify a reference to a web-container specific GBean either via a pattern to the moduleId of the configuration, or via a link to a GBean. As an example, consider the case where it is required to run a web application in a Tomcat container using a dedicated port such that no other web application is allowed to use that port. To accomplish this a separate GBean would have to be defined for the "Container", "Engine", "Host", and "Connector". And finally, an example geronimo-web.xml file is shown below using the , and a <naming:web-container> element would have to be used to reference the this new Tomcat container using a GBean link. An example geronimo-web.xml file is shown below:

Code Block
xml
xml
borderStylesolid
title<naming:web-container> Example
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1"
         xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.2"
         xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2">

    <sys:environment>

        <sys:moduleId>
            <sys:groupId>default</sys:groupId>
            <sys:artifactId>geronimo-web-6</sys:artifactId>
            <sys:version>1.0</sys:version>
            <sys:type>car</sys:type>
        </sys:moduleId>

        <sys:dependencies>
            <sys:dependency>
                <sys:groupId>org.apache.geronimo.configs</sys:groupId>
                <sys:artifactId>tomcat6</sys:artifactId>
                <sys:version>2.1.1</sys:version>
                <sys:type>car</sys:type>
            </sys:dependency>

            <sys:dependency>
                <sys:groupId>default</sys:groupId>
                <sys:artifactId>geronimo-web-5</sys:artifactId>
                <sys:version>1.0</sys:version>
                <sys:type>car</sys:type>
            </sys:dependency>

        </sys:dependencies>

        <sys:hidden-classes/>
        <sys:non-overridable-classes/>
        <sys:inverse-classloading/>
        <sys:suppress-default-environment/>

    </sys:environment> 

    <context-root>contextroot</web:context-root>

    <work-dir>workdir</web:work-dir>   

    <naming:web-container>
        <naming:gbean-link>TomcatWebAppContainer</naming:gbean-link>
    </naming:web-container>

    <gbean name="TomcatWebAppContainer" class="org.apache.geronimo.tomcat.TomcatContainer">
        <attribute name="catalinaHome">var/catalina</attribute>
        <reference name="EngineGBean">
            <name>TomcatEngine1</name>
        </reference>
        <reference name="ServerInfo">
            <name>ServerInfo</name>
        </reference>
        <reference name="WebManager">
            <name>TomcatWebManager</name>
        </reference>
    </gbean>

    <gbean name="TomcatWebAppEngine" class="org.apache.geronimo.tomcat.EngineGBean">
        <attribute name="className">org.apache.geronimo.tomcat.TomcatEngine</attribute>
        <attribute name="initParams">
            name=WASCE
        </attribute>
        <reference name="DefaultHost">
            <name>TomcatHost1</name>
        </reference>
        <references name="Hosts">
            <pattern>
                <name>TomcatHost</name>
            </pattern>
        </references>
        <reference name="RealmGBean">
            <name>TomcatJAASRealm</name>
        </reference>
        <reference name="TomcatValveChain">
            <name>FirstValve</name>
        </reference>
        <reference name="LifecycleListenerChain">
            <name>FirstListener</name>
        </reference>
    </gbean>

    <gbean name="TomcatWebAppHost" class="org.apache.geronimo.tomcat.HostGBean">
        <attribute name="className">org.apache.catalina.core.StandardHost</attribute>
        <attribute name="initParams">
            name=localhost
            appBase=
            workDir=work
        </attribute>
    </gbean>

    <gbean name="TomcatWebAppConnector" class="org.apache.geronimo.tomcat.ConnectorGBean">
        <attribute name="name">HTTP</attribute>
        <attribute name="host">localhost</attribute>
        <attribute name="port">8081</attribute>                             <!-- Use port 8081 instead of the default of 8080 -->
        <attribute name="maxHttpHeaderSizeBytes">8192</attribute>   
        <attribute name="maxThreads">150</attribute>
        <attribute name="minSpareThreads">25</attribute>
        <attribute name="maxSpareThreads">75</attribute>
        <attribute name="hostLookupEnabled">false</attribute>
        <attribute name="redirectPort">8453</attribute>
        <attribute name="acceptQueueSize">100</attribute>
        <attribute name="connectionTimeoutMillis">20000</attribute>
        <attribute name="uploadTimeoutEnabled">false</attribute>
        <reference name="TomcatContainer">
            <name>TomcatWebAppContainer</name>
        </reference>
    </gbean>

</web-app>

...