Difference between revisions of "Jetty/Reference/jetty-env.xml"

From Eclipsepedia

Jump to: navigation, search
Line 1: Line 1:
 
{{Jetty Reference
 
{{Jetty Reference
| introduction = <tt>jetty-env.xml</tt> is an optional Jetty configuration file which configures webapp-specific JNDI resources. The format of <tt>jetty-web.xml</tt> is the same as <tt>[[Jetty/References/jetty.xml|jetty.xml]]</tt> -- it is an XML mapping of the Jetty API.
+
| introduction = <tt>jetty-env.xml</tt> is an optional Jetty configuration file which configures webapp-specific JNDI resources. The format of <tt>jetty-web.xml</tt> is the same as <tt>[[Jetty/Reference/jetty.xml|jetty.xml]]</tt> -- it is an XML mapping of the Jetty API.
  
This document offers an overview for using the <tt>jetty-env.xml</tt> configuration file. For a more in-depth look at the syntax, see [[Jetty/References/Syntax Reference|Syntax Reference]]. [
+
This document offers an overview for using the <tt>jetty-env.xml</tt> configuration file. For a more in-depth look at the syntax, see [[Jetty/Reference/jetty.xml Syntax|jetty.xml Syntax Reference]].
  
 
| body =  
 
| body =  
Line 22: Line 22:
 
== Using <tt>jetty-env.xml</tt> ==
 
== Using <tt>jetty-env.xml</tt> ==
  
Place the <tt>jetty-env.xml</tt> file into your web application's WEB-INF folder. When Jetty deploys a web application, it automatically looks for a file called <tt>WEB-INF/jetty-env.xml</tt> within the web application (or WAR), and sets up the webapp naming environment so that naming references in the <tt>WEB-INF/web.xml</tt> file can be resolved from the information provided in the <tt>WEB-INF/jetty-env.xml</tt> and <tt>[[Jetty/References/jetty.xml]]</tt> files.
+
Place the <tt>jetty-env.xml</tt> file into your web application's WEB-INF folder. When Jetty deploys a web application, it automatically looks for a file called <tt>WEB-INF/jetty-env.xml</tt> within the web application (or WAR), and sets up the webapp naming environment so that naming references in the <tt>WEB-INF/web.xml</tt> file can be resolved from the information provided in the <tt>WEB-INF/jetty-env.xml</tt> and <tt>[[Jetty/Reference/jetty.xml]]</tt> files.
  
 
<tt>jetty-env.xml</tt> files contain configuration specific to a webapp. Global naming resources should be defined on the server via <tt>jetty.xml</tt>.
 
<tt>jetty-env.xml</tt> files contain configuration specific to a webapp. Global naming resources should be defined on the server via <tt>jetty.xml</tt>.
Line 31: Line 31:
  
 
| more =  
 
| more =  
* [[Jetty/References/Syntax Reference|Syntax Reference]] - in-depth reference for Jetty-specific configuration XML syntax
+
* [[Jetty/Reference/jetty.xml Syntax|jetty.xml Syntax Reference]] - in-depth reference for Jetty-specific configuration XML syntax
* [[Jetty/References/jetty.xml|jetty.xml]] - configuration file for configuring the entire server
+
* [[Jetty/Reference/jetty.xml|jetty.xml]] - configuration file for configuring the entire server
  
 
}}
 
}}

Revision as of 01:51, 29 June 2009



Contents

Introduction

jetty-env.xml is an optional Jetty configuration file which configures webapp-specific JNDI resources. The format of jetty-web.xml is the same as jetty.xml -- it is an XML mapping of the Jetty API.

This document offers an overview for using the jetty-env.xml configuration file. For a more in-depth look at the syntax, see jetty.xml Syntax Reference.

Root Element

jetty-env.xml is applied on a per-webapp basis, and configures an instance of org.eclipse.jetty.webapp.WebAppContext.

<?xml version="1.0"  encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
 
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
 ..
</Configure>
Warning

Make sure you are applying the configuration to an instance of the proper class. jetty-env.xml configures an instance of WebAppContext, and not an instance of Server


Using jetty-env.xml

Place the jetty-env.xml file into your web application's WEB-INF folder. When Jetty deploys a web application, it automatically looks for a file called WEB-INF/jetty-env.xml within the web application (or WAR), and sets up the webapp naming environment so that naming references in the WEB-INF/web.xml file can be resolved from the information provided in the WEB-INF/jetty-env.xml and Jetty/Reference/jetty.xml files.

jetty-env.xml files contain configuration specific to a webapp. Global naming resources should be defined on the server via jetty.xml.

Additional Resources