...
The <naming:web-container> XML element uses the Geronimo Naming namespace, which is used to identify the common elements for
resolving EJB references, resource references, and Web services references, and is described here:
It This element is used to specify a reference to a web-container specific GBean either via a pattern to moduleId of the configuration, or via a link to a GBean. An 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 <naming:web-container> elements: element to reference the new Tomcat container using a GBean link:
Code Blockcode | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<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:pattern>gbean-link>TomcatWebAppContainer</naming:gbean-link> <naming:groupId>gbeanlocator-pattern-groupid<</naming:groupId>web-container> <gbean name="TomcatWebAppContainer" class="org.apache.geronimo.tomcat.TomcatContainer"> <naming:artifactId>gbeanlocator-pattern-artifactid</naming:artifactId> <attribute name="catalinaHome">var/catalina</attribute> <naming:version>gbeanlocator-pattern-version</naming:version> <reference name="EngineGBean"> <name>TomcatEngine1</name> </reference> <naming:module>gbeanlocator-pattern-module</naming:module><reference name="ServerInfo"> <naming:name>gbeanlocator-pattern-name</naming:<name>ServerInfo</name> </naming:pattern>reference> <naming:gbean-link>gbeanlocator-gbeanlink</naming:gbean-link><reference name="WebManager"> </naming:web-container> <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> |
<container-config>
...