| <html><head> |
| <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
| <title>Chapter 32. Jetty XML Reference</title><link rel="stylesheet" type="text/css" href="css/docbook.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><meta name="keywords" content="jetty, servlet, servlet-api, cometd, http, websocket, eclipse, maven, java, server, software"><link rel="home" href="index.html" title="Jetty"><link rel="up" href="jetty-ref-guide.html" title="Part V. Jetty Reference Guide"><link rel="prev" href="ubuntu.html" title="Ubuntu"><link rel="next" href="jetty-xml-usage.html" title="Jetty XML Usage"><link xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" rel="shortcut icon" href="images/favicon.ico"><link rel="stylesheet" href="css/highlighter/foundation.css"><script src="js/highlight.pack.js"></script><script> |
| hljs.initHighlightingOnLoad(); |
| </script><link type="text/css" rel="stylesheet" href="css/font-awesome/font-awesome.min.css"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><tr><td style="width: 25%"><a href="http://www.eclipse.org/jetty"><img src="images/jetty-header-logo.png" alt="Jetty Logo"></a><br><span style="font-size: small"> |
| Version: 9.4.28-SNAPSHOT</span></td><td style="width: 50%"></td></tr></table><div xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 32. Jetty XML Reference</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ubuntu.html"><i class="fa fa-chevron-left" aria-hidden="true"></i> Previous</a> </td><th width="60%" align="center">Part V. Jetty Reference Guide<br><a accesskey="p" href="index.html"><i class="fa fa-home" aria-hidden="true"></i> Home</a></th><td width="20%" align="right"> <a accesskey="n" href="jetty-xml-usage.html">Next <i class="fa fa-chevron-right" aria-hidden="true"></i></a></td></tr></table><hr></div><div xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" class="jetty-callout"><h5 class="callout"><a href="http://www.webtide.com/">Contact the core Jetty developers at |
| <span class="website">www.webtide.com</span></a></h5><p> |
| private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... |
| scalability guidance for your apps and Ajax/Comet projects ... development services for sponsored feature development |
| </p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="reference-section"></a>Chapter 32. Jetty XML Reference</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="section"><a href="reference-section.html#jetty-xml-syntax">Jetty XML Syntax</a></span></dt><dt><span class="section"><a href="jetty-xml-usage.html">Jetty XML Usage</a></span></dt><dt><span class="section"><a href="jetty-xml-config.html">jetty.xml</a></span></dt><dt><span class="section"><a href="jetty-web-xml-config.html">jetty-web.xml</a></span></dt><dt><span class="section"><a href="jetty-env-xml.html">jetty-env.xml</a></span></dt><dt><span class="section"><a href="webdefault-xml.html">webdefault.xml</a></span></dt><dt><span class="section"><a href="override-web-xml.html">Jetty override-web.xml</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="jetty-xml-syntax"></a>Jetty XML Syntax</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="reference-section.html#basic-xml-configuration-file-example">Basic XML Configuration File Example</a></span></dt><dt><span class="section"><a href="reference-section.html#_overview_2">Overview</a></span></dt><dt><span class="section"><a href="reference-section.html#jetty-xml-configure"><Configure></a></span></dt><dt><span class="section"><a href="reference-section.html#jetty-xml-set"><Set></a></span></dt><dt><span class="section"><a href="reference-section.html#jetty-xml-get"><Get></a></span></dt><dt><span class="section"><a href="reference-section.html#jetty-xml-put"><Put></a></span></dt><dt><span class="section"><a href="reference-section.html#jetty-xml-call"><Call></a></span></dt><dt><span class="section"><a href="reference-section.html#jetty-xml-arg"><Arg></a></span></dt><dt><span class="section"><a href="reference-section.html#jetty-xml-new"><New></a></span></dt><dt><span class="section"><a href="reference-section.html#jetty-xml-ref"><Ref></a></span></dt><dt><span class="section"><a href="reference-section.html#jetty-xml-array"><Array></a></span></dt><dt><span class="section"><a href="reference-section.html#jetty-xml-item"><Item></a></span></dt><dt><span class="section"><a href="reference-section.html#jetty-xml-map"><Map></a></span></dt><dt><span class="section"><a href="reference-section.html#jetty-xml-entry"><Entry></a></span></dt><dt><span class="section"><a href="reference-section.html#jetty-xml-system-property"><SystemProperty></a></span></dt><dt><span class="section"><a href="reference-section.html#jetty-xml-property"><Property></a></span></dt></dl></div><p>The Jetty XML syntax is a straightforward mapping of XML elements to a Java API so that POJOs can be instantiated and getters, setters, and methods called. |
| It is very similar to Inversion Of Control (IOC) or Dependency Injection (DI) frameworks like Spring or Plexus (but it predates all of them). |
| Typically Jetty XML is used by <code class="literal">jetty.xml</code> to configure a Jetty server or by a <code class="literal">context.xml</code> file to configure a ContextHandler or subclass, but you can also use the mechanism to configure arbitrary POJOs.</p><p>This page describes the basic syntax of Jetty XML configuration. See <a class="xref" href="jetty-xml-usage.html" title="Jetty XML Usage">Jetty XML Usage</a> for information on how you can use and combine Jetty XML. |
| See configuration files for specific examples.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="basic-xml-configuration-file-example"></a>Basic XML Configuration File Example</h3></div></div></div><p>The following XML configuration file creates some Java objects and sets some attributes:</p><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code><?xml version="1.0"?> |
| <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd"> |
| <Configure id="foo" class="com.acme.Foo"> |
| <Set name="name">demo</Set> |
| <Set name="nested"> |
| <New id="bar" class="com.acme.Bar"> |
| <Arg>true</Arg> |
| <Set name="wibble">10</Set> |
| <Set name="wobble">xyz</Set> |
| <Set name="parent"><Ref refid="foo"/></Set> |
| <Call name="init"> |
| <Arg>false</Arg> |
| </Call> |
| </New> |
| </Set> |
| |
| <Ref refid="bar"> |
| <Set name="wibble">20</Set> |
| <Get name="parent"> |
| <Set name="name">demo2</Set> |
| </Get> |
| </Ref> |
| </Configure></code></pre><p>The XML above is equivalent to the following Java code:</p><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code>com.acme.Foo foo = new com.acme.Foo(); |
| foo.setName("demo"); |
| |
| com.acme.Bar bar = new com.acme.Bar(true); |
| bar.setWibble(10); |
| bar.setWobble("xyz"); |
| bar.setParent(foo); |
| bar.init(false); |
| |
| foo.setNested(bar); |
| |
| bar.setWibble(20); |
| bar.getParent().setName("demo2");</code></pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_overview_2"></a>Overview</h3></div></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="jetty-xml-dtd"></a>Understanding DTD and Parsing</h4></div></div></div><p>The document type descriptor |
| (<a class="link" href="https://github.com/eclipse/jetty.project/tree/jetty-9.4.x/jetty-xml/src/main/resources/org/eclipse/jetty/xml/configure_9_0.dtd?h=release-9" target="_top">configure.dtd</a>) describes all valid elements in a Jetty XML configuration file using the Jetty IoC format. |
| The first two lines of an XML must reference the DTD to be used to validate the XML like:</p><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code><?xml version="1.0" encoding="UTF-8"?> |
| <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd"> |
| ...</code></pre><p>Typcically a good XML editor will fetch the DTD from the URL and use it to give syntax highlighting and validation while a configuration file is being edited. |
| Some editors also allows DTD files to be locally cached. |
| The URL may point to configure.dtd if you want the latest current version, or to a specific version like configure_9_3.dtd if you want a particular validation feature set.</p><p>Files that conform to the configure.dtd format are processed in Jetty by the <code class="literal">XmlConfiguration</code> class which may also validate the XML (using a version of the DTD from the classes jar file), but is by default run in a forgiving mode that tries to work around validation failures.</p><p>To ensure your <code class="literal">web.xml</code>, <code class="literal">web-fragment.xml</code> and <code class="literal">webdefault.xml</code> files are validated, you will also need to set the <code class="literal">validateXml</code> attribute to true:</p><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code><Call name="setAttribute"> |
| <Arg>org.eclipse.jetty.webapp.validateXml</Arg> |
| <Arg type="Boolean">true</Arg> |
| </Call></code></pre></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_jetty_xml_configuration_scope"></a>Jetty XML Configuration Scope</h4></div></div></div><p>The configuration of object instances with Jetty IoC XML is done on a scoped basis, so that for any given XML element there is a corresponding Object in scope and the nested XML elements apply to that. |
| The outer most scope is given by a Configure element and elements like Call, New and Get establish new scopes. |
| The following example uses the name fields to explain the scope.</p><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code><Configure class="com.example.Foo"> |
| <Set name="fieldOnFoo">value</Set> |
| <Set name="fieldOnFoo"> |
| <New class="com.example.Bar"> |
| <Set name=fieldOnBar>value</Set> |
| <Call name="methodOnBarWithNoArgs"/> |
| </New> |
| </Set> |
| |
| <Call name="methodOnFoo"> |
| <Arg>value for first arg of methodOnFoo</Arg> |
| <Arg><New class="com.example.Bar"/></Arg> |
| <Set name="fieldOnObjectReturnedByMethodOnFoo">value</Set> |
| <Call name="methodOnObjectReturnedByMethodOnFooWithNoArgs"/> |
| </Call> |
| </Configure></code></pre></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_coercing_arguments_to_a_type"></a>Coercing Arguments to a Type</h4></div></div></div><p>When trying to match XML elements to java elements, Jetty <code class="literal">XmlConfiguration</code> may need to coerces values to match method arguments. |
| By default it does so on a best effort basis, but you can also specify explicit types with the <code class="literal">type</code> attribute. |
| Supported values for type are: <code class="literal">String</code>, <code class="literal">Character</code>, <code class="literal">Short</code>, <code class="literal">Byte</code>, <code class="literal">Integer</code>, <code class="literal">Long</code>, <code class="literal">Boolean</code>, <code class="literal">Float</code>, <code class="literal">Double</code>, <code class="literal">char</code>, <code class="literal">short</code>, <code class="literal">byte</code>, <code class="literal">int</code>, <code class="literal">long</code>, <code class="literal">boolean</code>, <code class="literal">float</code>, <code class="literal">double</code>, <code class="literal">URL</code>, <code class="literal">InetAddress</code>, <code class="literal">InetAddrPort</code>, and <code class="literal">void</code>.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_referring_to_a_class"></a>Referring to a Class</h4></div></div></div><p>If you do not specify the classname, Jetty assumes you are calling the method on the object that is current in scope (eg the object of the surrounding <code class="literal">Configure</code>, <code class="literal">New</code> or <code class="literal">Get</code> clause). |
| If the class attribute is specified to a fully-qualified class name, then it is either used to create a new instance (<code class="literal">Configure</code> and <code class="literal">New</code> elements) or is used to access a static (<code class="literal">Call</code>, <code class="literal">Set</code> or <code class="literal">Get</code> elements).</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_referring_to_an_object"></a>Referring to an Object</h4></div></div></div><p>You can use the id attribute to store a reference to the current object when first creating or referring to this object. |
| You can then use the <a class="link" href="reference-section.html#jetty-xml-ref" title="<Ref>">Ref element</a> to reference the object later. |
| The ID must be unique for each object you create.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_attribute_vs_element_style"></a>Attribute vs Element Style</h4></div></div></div><p>For XML elements that contain only other XML Elements, there is a choice of using attributes or elements style. |
| The following is an example of attribute style:</p><pre class="literallayout"> <Call id="result" class="org.example.SomeClass" name="someMethod" arg="value0,value1"/></pre><p>Attribute style has the benefit of brevity, but is limited by: values can only be Strings; multivalued items can not contain <span class="emphasis"><em>,</em></span>; values may not be subject to property expansion or other elements that return values. |
| Thus, the more verbose element style is available and the following is semantically equivalent to the attribute style above:</p><pre class="literallayout"> <Call> |
| <Id>result</Id> |
| <Class>org.example.SomeClass</Class> |
| <Name>someMethod</Name> |
| <Arg>value0</Arg> |
| <Arg>value1</Arg> |
| </Call></pre><p>Note that multivalued elements like <code class="literal">Arg</code> must be repeated and may not be comma-separated like they are when provided as attributes. |
| It is possible to use a mix of styles and the following example shows a moretypical example that uses property expansion as the reason for element style:</p><pre class="literallayout"> <Call id="result" name="someMethod"> |
| <Class><Property name="which.class"> |
| <Default><Property name="default.class" default="org.example.SomeClass"/> |
| </Property></Class> |
| <Arg>value0</Arg> |
| <Arg>value1</Arg> |
| </Call></pre><p>Attributes may not be expressed as elements when their parent element is one that contains data. |
| Thus <code class="literal">Arg</code>, <code class="literal">Item</code>, <code class="literal">Set</code>, <code class="literal">Put</code> and <code class="literal">Get</code> elements may not have their attributes expressed as elements.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="jetty-xml-configure"></a><Configure></h3></div></div></div><p>This is the root element that specifies the class of object that is to be configured. |
| It is usually either the Server, in <code class="literal">jetty.xml</code>, or a <code class="literal">WebAppContext</code> in <code class="literal">jetty-web.xml</code>.</p><div class="informaltable"><table class="informaltable" border="1"><colgroup><col class="col_1"><col class="col_2"><col class="col_3"></colgroup><thead><tr><th align="left" valign="top">Attribute</th><th align="left" valign="top">Required</th><th align="left" valign="top">Description</th></tr></thead><tbody><tr><td align="left" valign="top"><p>id</p></td><td align="left" valign="top"><p>no</p></td><td align="left" valign="top"><p>A reference to the object that was created. If you define |
| multiple <a class="link" href="reference-section.html#jetty-xml-configure" title="<Configure>">Configure element</a>s with the same id, |
| they will be treated as one object, even if they’re in different files. |
| You can use this to break up configuration of an object (such as the |
| Server) across multiple files.</p></td></tr><tr><td align="left" valign="top"><p>class</p></td><td align="left" valign="top"><p>no</p></td><td align="left" valign="top"><p>The fully qualified classname of the object to be |
| configured. Could be <code class="literal">org.eclipse.jetty.server.Server</code>, |
| <code class="literal">org.eclipse.jetty.webapp.WebAppContext</code>, a handler, etc.</p></td></tr></tbody></table></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_can_contain"></a>Can Contain</h4></div></div></div><p><a class="link" href="reference-section.html#jetty-xml-set" title="<Set>">Set element</a>, <a class="link" href="reference-section.html#jetty-xml-get" title="<Get>">Get element</a>, |
| <a class="link" href="reference-section.html#jetty-xml-put" title="<Put>">Put element</a>, <a class="link" href="reference-section.html#jetty-xml-call" title="<Call>">Call element</a>, |
| <a class="link" href="reference-section.html#jetty-xml-new" title="<New>">New element</a>, <a class="link" href="reference-section.html#jetty-xml-ref" title="<Ref>">Ref element</a>, |
| <a class="link" href="reference-section.html#jetty-xml-array" title="<Array>">Array element</a>, <a class="link" href="reference-section.html#jetty-xml-map" title="<Map>">Map element</a>, |
| <a class="link" href="reference-section.html#jetty-xml-property" title="<Property>">Property element</a></p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_examples_2"></a>Examples</h4></div></div></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a name="_basic_example"></a>Basic Example</h5></div></div></div><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code><Configure class="org.eclipse.jetty.server.Server"> |
| <Set name="port">8080</Set> |
| </Configure></code></pre><p>This is equivalent to:</p><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code>org.eclipse.jetty.server.Server server = new org.eclipse.jetty.server.Server(); |
| server.setPort(8080);</code></pre></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a name="_using_id_to_break_up_configuration_of_one_object_across_multiple_files"></a>Using id to break up configuration of one object across multiple files</h5></div></div></div><p>In <code class="literal">etc/jetty.xml</code>:</p><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code><Configure id="Server" class="org.eclipse.jetty.server.Server"> |
| <!-- basic configuration here --> |
| </Configure></code></pre><p>In <code class="literal">etc/jetty-logging.xml</code>:</p><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code><Configure id="Server" class="org.eclipse.jetty.server.Server"> |
| <!-- assumes that you have the basic server configuration set up; this file only contains additional configuration for logging --> |
| </Configure></code></pre><p>Then run the combined configuration using:</p><pre class="literallayout">java -jar start.jar etc/jetty.xml jetty-logging.xml</pre></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="jetty-xml-set"></a><Set></h3></div></div></div><p>A Set element maps to a call to a setter method or field on the current object. |
| It can contain text and/or elements such as <code class="literal">Call</code>, <code class="literal">New</code>, <code class="literal">SystemProperty</code>, etc., as values. |
| The name and optional type attributes are used to select the setter method. |
| If you do not specify a value type, white space is trimmed out of the value. |
| If it contains multiple elements as values, they are added as strings before being converted to any specified type.</p><div class="informaltable"><table class="informaltable" border="1"><colgroup><col class="col_1"><col class="col_2"><col class="col_3"></colgroup><thead><tr><th align="left" valign="top">Attribute</th><th align="left" valign="top">Required</th><th align="left" valign="top">Description</th></tr></thead><tbody><tr><td align="left" valign="top"><p>name</p></td><td align="left" valign="top"><p>yes</p></td><td align="left" valign="top"><p>the name of the setter method to call, or the field to set. |
| If the name given is xxx, then a setXxx method is used. If the setXxx |
| method cannot be found, then the xxx field is used.</p></td></tr><tr><td align="left" valign="top"><p>type</p></td><td align="left" valign="top"><p>no</p></td><td align="left" valign="top"><p>the declared type of the argument. See also discussion of |
| type for Arg for how to define null and empty string values.</p></td></tr><tr><td align="left" valign="top"><p>class</p></td><td align="left" valign="top"><p>no</p></td><td align="left" valign="top"><p>if present, then this Set is treated as a static set method |
| invocation</p></td></tr></tbody></table></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_can_contain_2"></a>Can Contain</h4></div></div></div><p>value text, <a class="link" href="reference-section.html#jetty-xml-get" title="<Get>">Get element</a>, <a class="link" href="reference-section.html#jetty-xml-call" title="<Call>">Call |
| element</a>, <a class="link" href="reference-section.html#jetty-xml-new" title="<New>">New element</a>, <a class="link" href="reference-section.html#jetty-xml-ref" title="<Ref>">Ref |
| element</a>, <a class="link" href="reference-section.html#jetty-xml-array" title="<Array>">Array element</a>, <a class="link" href="reference-section.html#jetty-xml-map" title="<Map>">Map |
| element</a>, <a class="link" href="reference-section.html#jetty-xml-system-property" title="<SystemProperty>">System Property element</a>, |
| <a class="link" href="reference-section.html#jetty-xml-property" title="<Property>">Property element</a></p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_examples_3"></a>Examples</h4></div></div></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a name="_basic_example_2"></a>Basic Example</h5></div></div></div><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code><Configure id="server" class="org.eclipse.jetty.server.Server"> |
| <Set name="port">8080</Set> |
| </Configure></code></pre></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a name="_set_via_a_system_property"></a>Set via a System Property</h5></div></div></div><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code><Configure id="server" class="org.eclipse.jetty.server.Server"> |
| <Set name="port"><SystemProperty name="jetty.http.port" /></Set> |
| </Configure></code></pre></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a name="_creating_a_newobject_and_setting_it_on_the_server"></a>Creating a NewObject and Setting It on the Server</h5></div></div></div><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code><Configure id="server" class="org.eclipse.jetty.server.Server"> |
| <Set name="threadPool"> |
| <New class="org.eclipse.jetty.util.thread.QueuedThreadPool"> |
| <Set name="minThreads">10</Set> |
| <Set name="maxThreads">1000</Set> |
| </New> |
| </Set> |
| </Configure></code></pre><p>This is equivalent to:</p><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code>org.eclipse.jetty.server.Server server = new org.eclipse.jetty.server.Server(); |
| |
| org.eclipse.jetty.util.thread.QueuedThreadPool threadPool = new org.eclipse.jetty.util.thread.QueuedThreadPool(); |
| threadPool.setMinThreads(10); |
| threadPool.setMaxThreads(1000); |
| |
| server.setThreadPool(threadPool);</code></pre></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a name="_invoking_a_static_setter"></a>Invoking a Static Setter</h5></div></div></div><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code><Configure id="server" class="org.eclipse.jetty.server.Server"> |
| <Set class="org.eclipse.jetty.util.log.Log" name="logToParent">loggerName</Set> |
| </Configure></code></pre></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="jetty-xml-get"></a><Get></h3></div></div></div><p>A Get element maps to a call to a getter method or field on the current object. |
| It can contain nested elements such as <code class="literal">Set</code>, <code class="literal">Put</code>, <code class="literal">Call</code>, etc.; these act on the object returned by the <code class="literal">Get</code> call.</p><div class="informaltable"><table class="informaltable" border="1"><colgroup><col class="col_1"><col class="col_2"><col class="col_3"></colgroup><thead><tr><th align="left" valign="top">Attribute</th><th align="left" valign="top">Required</th><th align="left" valign="top">Description</th></tr></thead><tbody><tr><td align="left" valign="top"><p>name</p></td><td align="left" valign="top"><p>yes</p></td><td align="left" valign="top"><p>the name of the getter method to call, or the field to get. |
| If the name given is xxx, then a getXxx method is used. If the getXxx |
| method cannot be found, then the xxx field is used.</p></td></tr><tr><td align="left" valign="top"><p>class</p></td><td align="left" valign="top"><p>no</p></td><td align="left" valign="top"><p>f present, then this Get is treated as a static getter or |
| field.</p></td></tr><tr><td align="left" valign="top"><p>id</p></td><td align="left" valign="top"><p>no</p></td><td align="left" valign="top"><p>if present, then you can use this id to refer to the returned |
| object later.</p></td></tr></tbody></table></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_can_contain_3"></a>Can Contain</h4></div></div></div><p><a class="link" href="reference-section.html#jetty-xml-set" title="<Set>">Set element</a>, <a class="link" href="reference-section.html#jetty-xml-get" title="<Get>">Get element</a>, |
| <a class="link" href="reference-section.html#jetty-xml-put" title="<Put>">Put element</a>, <a class="link" href="reference-section.html#jetty-xml-call" title="<Call>">Call element</a>, |
| <a class="link" href="reference-section.html#jetty-xml-new" title="<New>">New element</a>, <a class="link" href="reference-section.html#jetty-xml-ref" title="<Ref>">Ref element</a>, |
| <a class="link" href="reference-section.html#jetty-xml-array" title="<Array>">Array element</a>, <a class="link" href="reference-section.html#jetty-xml-map" title="<Map>">Map element</a>, |
| <a class="link" href="reference-section.html#jetty-xml-property" title="<Property>">Property element</a></p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_examples_4"></a>Examples</h4></div></div></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a name="_basic_example_3"></a>Basic Example</h5></div></div></div><p>This simple example doesn’t do much on its own. |
| You would normally use this in conjunction with a <code class="literal"><Ref id="Logger" /></code>.</p><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code><Configure id="server" class="org.eclipse.jetty.server.Server"> |
| <Get id="Logger" class="org.eclipse.jetty.util.log.Log" name="log"/> |
| </Configure></code></pre></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a name="_invoking_a_static_getter_and_call_methods_on_the_returned_object"></a>Invoking a Static Getter and Call Methods on the Returned Object</h5></div></div></div><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code><Configure id="server" class="org.eclipse.jetty.server.Server"> |
| <Get class="java.lang.System" name="out"> |
| <Call name="println"> |
| <Arg>Server version is: <Get class="org.eclipse.jetty.server.Server" name="version"/></Arg> |
| </Call> |
| </Get> |
| </Configure></code></pre></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="jetty-xml-put"></a><Put></h3></div></div></div><p>A Put element maps to a call to a put method on the current object, which must implement the Map interface. |
| It can contain text and/or elements such as <code class="literal">Call</code>, <code class="literal">New</code>, <code class="literal">SystemProperty</code>, etc. as values. |
| If you do not specify a no value type, white space is trimmed out of the value. |
| If it contains multiple elements as values, they are added as strings before being converted to any specified type.</p><div class="informaltable"><table class="informaltable" border="1"><colgroup><col class="col_1"><col class="col_2"><col class="col_3"></colgroup><thead><tr><th align="left" valign="top">Attribute</th><th align="left" valign="top">Required</th><th align="left" valign="top">Description</th></tr></thead><tbody><tr><td align="left" valign="top"><p>name</p></td><td align="left" valign="top"><p>yes</p></td><td align="left" valign="top"><p>used as the put key</p></td></tr><tr><td align="left" valign="top"><p>type</p></td><td align="left" valign="top"><p>no</p></td><td align="left" valign="top"><p>forces the type of the value. See also discussion of type for |
| Arg for how to define null and empty string values.</p></td></tr></tbody></table></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_can_contain_4"></a>Can Contain</h4></div></div></div><p>value text, <a class="link" href="reference-section.html#jetty-xml-get" title="<Get>">Get element</a>, <a class="link" href="reference-section.html#jetty-xml-call" title="<Call>">Call |
| element</a>, <a class="link" href="reference-section.html#jetty-xml-new" title="<New>">New element</a>, <a class="link" href="reference-section.html#jetty-xml-ref" title="<Ref>">Ref |
| element</a>, <a class="link" href="reference-section.html#jetty-xml-array" title="<Array>">Array element</a>, <a class="link" href="reference-section.html#jetty-xml-map" title="<Map>">Map |
| element</a>, <a class="link" href="reference-section.html#jetty-xml-system-property" title="<SystemProperty>">System Property element</a>, |
| <a class="link" href="reference-section.html#jetty-xml-property" title="<Property>">Property element</a></p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_example_2"></a>Example</h4></div></div></div><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code><Get name="someKindOfMap"> |
| <Put name="keyName">objectValue</Put> |
| </Get></code></pre></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="jetty-xml-call"></a><Call></h3></div></div></div><p>A <code class="literal">Call</code> element maps to an arbitrary call to a method on the current object. |
| It can contain a sequence of Arg elements followed by a sequence of configuration elements, such as Set, Put, Call. |
| The <Arg>s are passed as arguments to the method; the sequence of configuration elements act on the object returned by the original call.</p><div class="informaltable"><table class="informaltable" border="1"><colgroup><col class="col_1"><col class="col_2"><col class="col_3"></colgroup><thead><tr><th align="left" valign="top">Attribute</th><th align="left" valign="top">Required</th><th align="left" valign="top">Description</th></tr></thead><tbody><tr><td align="left" valign="top"><p>name</p></td><td align="left" valign="top"><p>yes</p></td><td align="left" valign="top"><p>the name of the arbitrary method to call. The method called |
| will use the exact name you provide it.</p></td></tr><tr><td align="left" valign="top"><p>class</p></td><td align="left" valign="top"><p>no</p></td><td align="left" valign="top"><p>if present, then this Call is treated as a static method.</p></td></tr><tr><td align="left" valign="top"><p>id</p></td><td align="left" valign="top"><p>no</p></td><td align="left" valign="top"><p>if present, you can use this id to refer to any object returned |
| by the call, for later use.</p></td></tr><tr><td align="left" valign="top"><p>arg</p></td><td align="left" valign="top"><p>no</p></td><td align="left" valign="top"><p>comma separated list of arguments may be used for simple |
| string values rather than Arg elements</p></td></tr></tbody></table></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_can_contain_5"></a>Can Contain</h4></div></div></div><p>Attributes as elements (Id, Name, Class) plus <a class="link" href="reference-section.html#jetty-xml-arg" title="<Arg>">Arg |
| element</a>, <a class="link" href="reference-section.html#jetty-xml-set" title="<Set>">Set element</a>, <a class="link" href="reference-section.html#jetty-xml-get" title="<Get>">Get |
| element</a>, <a class="link" href="reference-section.html#jetty-xml-put" title="<Put>">Put element</a>, <a class="link" href="reference-section.html#jetty-xml-call" title="<Call>">Call |
| element</a>, <a class="link" href="reference-section.html#jetty-xml-new" title="<New>">New element</a>, <a class="link" href="reference-section.html#jetty-xml-ref" title="<Ref>">Ref |
| element</a>, <a class="link" href="reference-section.html#jetty-xml-array" title="<Array>">Array element</a>, <a class="link" href="reference-section.html#jetty-xml-map" title="<Map>">Map |
| element</a>, <a class="link" href="reference-section.html#jetty-xml-property" title="<Property>">Property element</a></p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_examples_5"></a>Examples</h4></div></div></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a name="_basic_example_4"></a>Basic example</h5></div></div></div><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code><Call name="doFoo"> |
| <Arg>bar</Arg> |
| <Set name="test">1, 2, 3</Set> |
| </Call></code></pre><p>This is equivalent to:</p><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code>Object o2 = o1.doFoo("bar"); |
| o2.setTest("1, 2, 3");</code></pre></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a name="_invoking_a_static_method"></a>Invoking a static method</h5></div></div></div><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code><Call class="com.acme.Foo" name="setString"> |
| <Arg>somestring</Arg> |
| </Call></code></pre><p>Which is equivalent to:</p><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code>com.acme.Foo.setString("somestring");</code></pre></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a name="_invoking_the_actual_methodinstead_of_relying_on_getter_setter_magic"></a>Invoking the Actual MethodInstead of Relying on Getter/Setter Magic</h5></div></div></div><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code><Configure id="Server" class="org.eclipse.jetty.server.Server"> |
| <Call name="getPort" id="port" /> |
| <Call class="com.acme.Environment" name="setPort"> |
| <Arg> |
| <Ref refid="port"/> |
| </Arg> |
| </Call> |
| </Configure></code></pre><p>Which is equivalent to:</p><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code>org.mortbay.jetty.Server server = new org.mortbay.jetty.Server(); |
| com.acme.Environment.setPort( server.getPort() );</code></pre></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="jetty-xml-arg"></a><Arg></h3></div></div></div><p>An Arg element can be an argument of either a method or a constructor. |
| Use it within <a class="link" href="">] and xref:jetty-syntax-new[</a>.</p><p>It can contain text and/or elements, such as <code class="literal">Call</code>, <code class="literal">New</code>, <code class="literal">SystemProperty</code>, etc., as values. |
| The optional type attribute can force the type of the value. |
| If you don’t specify a type, white space is trimmed out of the value. |
| If it contains multiple elements as values, they are added as strings before being converted to any specified type. |
| Simple <code class="literal">String</code> arguments can also be specified as a string separated arg attribute on the parent element.</p><div class="informaltable"><table class="informaltable" border="1"><colgroup><col class="col_1"><col class="col_2"><col class="col_3"></colgroup><thead><tr><th align="left" valign="top">Attribute</th><th align="left" valign="top">Required</th><th align="left" valign="top">Description</th></tr></thead><tbody><tr><td align="left" valign="top"><p>type</p></td><td align="left" valign="top"><p>no</p></td><td align="left" valign="top"><p>force the type of the argument. If you do not provide a value |
| for the element, if you use type of "String", the value will be the |
| empty string (""), otherwise it is null.</p></td></tr></tbody></table></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_can_contain_6"></a>Can Contain</h4></div></div></div><p>value text, <a class="link" href="reference-section.html#jetty-xml-get" title="<Get>">Get element</a>, <a class="link" href="reference-section.html#jetty-xml-call" title="<Call>">Call |
| element</a>, <a class="link" href="reference-section.html#jetty-xml-new" title="<New>">New element</a>, <a class="link" href="reference-section.html#jetty-xml-ref" title="<Ref>">Ref |
| element</a>, <a class="link" href="reference-section.html#jetty-xml-array" title="<Array>">Array element</a>, <a class="link" href="reference-section.html#jetty-xml-map" title="<Map>">Map |
| element</a>, <a class="link" href="reference-section.html#jetty-xml-system-property" title="<SystemProperty>">System Property element</a>, |
| <a class="link" href="reference-section.html#jetty-xml-property" title="<Property>">Property element</a></p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_examples_6"></a>Examples</h4></div></div></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a name="_basic_examples"></a>Basic examples</h5></div></div></div><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code><Arg>foo</Arg> <!-- String --> |
| <Arg>true</Arg> <!-- Boolean --> |
| <Arg>1</Arg> <!-- int, long, short, float, double --> |
| <Arg><Ref refid="foo" /></Arg> <!-- any object; reference a previously created object with id "foo", and pass it as a parameter --> |
| <Arg></Arg> <!-- null value --> |
| <Arg type="String"></Arg> <!-- empty string "" --></code></pre></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a name="_coercing_type"></a>Coercing Type</h5></div></div></div><p>This explicitly coerces the type to a boolean:</p><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code><Arg type="boolean">False</Arg></code></pre></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a name="_as_a_parameter"></a>As a Parameter</h5></div></div></div><p>Here are a couple of examples of <a class="link" href="reference-section.html#jetty-xml-arg" title="<Arg>">Arg element</a> being used as a parameter to methods and to constructors:</p><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code><Call class="com.acme.Environment" name="setFoo"> |
| <Arg> |
| <New class="com.acme.Foo"> |
| <Arg>bar</Arg> |
| </New> |
| </Arg> |
| </Call></code></pre><p>This is equivalent to:</p><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code>com.acme.Environment.setFoo(new com.acme.Foo("bar"));</code></pre><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code><New class="com.acme.Baz"> |
| <Arg> |
| <Call id="bar" class="com.acme.MyStaticObjectFactory" name="createObject"> |
| <Arg>2</Arg> |
| </Call> |
| </Arg> |
| </New></code></pre><p>This is equivalent to:</p><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code>new com.acme.Baz(com.acme.MyStaticObjectFactory.createObject(2));</code></pre></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="jetty-xml-new"></a><New></h3></div></div></div><p>Instantiates an object. |
| Equivalent to <code class="literal">new</code> in Java, and allows the creation of a new object. |
| A <code class="literal">New</code> element can contain a sequence of <a class="link" href="reference-section.html#jetty-xml-arg" title="<Arg>"><code class="literal">Arg</code> element</a>'s, followed by a sequence of configuration elements (<code class="literal">Set</code>, <code class="literal">Put</code>, etc). |
| <a class="link" href="reference-section.html#jetty-xml-arg" title="<Arg>"><code class="literal">Arg</code> element</a>'s are used to select a constructor for the object to be created. |
| The sequence of configuration elements then acts on the newly-created object.</p><div class="informaltable"><table class="informaltable" border="1"><colgroup><col class="col_1"><col class="col_2"><col class="col_3"></colgroup><thead><tr><th align="left" valign="top">Attribute</th><th align="left" valign="top">Required</th><th align="left" valign="top">Description</th></tr></thead><tbody><tr><td align="left" valign="top"><p>class</p></td><td align="left" valign="top"><p>yes</p></td><td align="left" valign="top"><p>fully qualified classname, which determines the type of the |
| new object that is instantiated.</p></td></tr><tr><td align="left" valign="top"><p>id</p></td><td align="left" valign="top"><p>no</p></td><td align="left" valign="top"><p>gives a unique name to the object which can be referenced later |
| by Ref elements.</p></td></tr><tr><td align="left" valign="top"><p>arg</p></td><td align="left" valign="top"><p>no</p></td><td align="left" valign="top"><p>comma separated list of arguments may be used for simple |
| string values rather than Arg elements</p></td></tr></tbody></table></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_can_contain_7"></a>Can Contain</h4></div></div></div><p>Attributes as elements (Id, Class) plus <a class="link" href="reference-section.html#jetty-xml-arg" title="<Arg>">Arg |
| element</a>, <a class="link" href="reference-section.html#jetty-xml-set" title="<Set>">Set element</a>, <a class="link" href="reference-section.html#jetty-xml-get" title="<Get>">Get |
| element</a>, <a class="link" href="reference-section.html#jetty-xml-put" title="<Put>">Put element</a>, <a class="link" href="reference-section.html#jetty-xml-call" title="<Call>">Call |
| element</a>, <a class="link" href="reference-section.html#jetty-xml-new" title="<New>">New element</a>, <a class="link" href="reference-section.html#jetty-xml-ref" title="<Ref>">Ref |
| element</a>, <a class="link" href="reference-section.html#jetty-xml-array" title="<Array>">Array element</a>, <a class="link" href="reference-section.html#jetty-xml-map" title="<Map>">Map |
| element</a>, <a class="link" href="reference-section.html#jetty-xml-property" title="<Property>">Property element</a></p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_examples_7"></a>Examples</h4></div></div></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a name="_basic_example_5"></a>Basic example</h5></div></div></div><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code><New class="com.acme.Foo"> |
| <Arg>bar</Arg> |
| </New></code></pre><p>Which is equivalent to:</p><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code>com.acme.Foo foo = new com.acme.Foo("bar");</code></pre></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a name="_instantiate_with_the_default_constructor"></a>Instantiate with the Default Constructor</h5></div></div></div><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code><New class="com.acme.Foo" /></code></pre><p>Which is equivalent to:</p><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code>com.acme.Foo foo = new com.acme.Foo();</code></pre></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a name="_instantiate_with_multiple_arguments_then_configuring_further"></a>Instantiate with Multiple Arguments, Then Configuring Further</h5></div></div></div><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code><New id="foo" class="com.acme.Foo"> |
| <Arg>bar</Arg> |
| <Arg>baz</Arg> |
| <Set name="test">1, 2, 3</Set> |
| </New></code></pre><p>Which is equivalent to:</p><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code>Object foo = new com.acme.Foo("bar", "baz"); |
| foo.setTest("1, 2, 3");</code></pre></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="jetty-xml-ref"></a><Ref></h3></div></div></div><p>A <code class="literal">Ref</code> element allows a previously created object to be referenced by a unique id. |
| It can contain a sequence of elements, such as <code class="literal">Set</code> or <code class="literal">Put</code> which then act on the referenced object. |
| You can also use a <code class="literal">Ref</code> element as a value for other elements such as <code class="literal">Set</code> and <code class="literal">Arg</code>.</p><p>The <code class="literal">Ref</code> element provides convenience and eases readability. |
| You can usually achieve the effect of the <code class="literal">Ref</code> by nesting elements (method calls), but this can get complicated very easily. |
| The Ref element makes it possible to refer to the same object if you’re using it multiple times, or passing it into multiple methods. |
| It also makes it possible to split up configuration across multiple files.</p><div class="informaltable"><table class="informaltable" border="1"><colgroup><col class="col_1"><col class="col_2"><col class="col_3"></colgroup><thead><tr><th align="left" valign="top">Attribute</th><th align="left" valign="top">Required</th><th align="left" valign="top">Description</th></tr></thead><tbody><tr><td align="left" valign="top"><p>refid</p></td><td align="left" valign="top"><p>yes</p></td><td align="left" valign="top"><p>the unique identifier used to name a previously created |
| object.</p></td></tr></tbody></table></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_can_contain_8"></a>Can Contain</h4></div></div></div><p><a class="link" href="reference-section.html#jetty-xml-set" title="<Set>">Set element</a>, <a class="link" href="reference-section.html#jetty-xml-get" title="<Get>">Get element</a>, |
| <a class="link" href="reference-section.html#jetty-xml-put" title="<Put>">Put element</a>, <a class="link" href="reference-section.html#jetty-xml-call" title="<Call>">Call element</a>, |
| <a class="link" href="reference-section.html#jetty-xml-new" title="<New>">New element</a>, <a class="link" href="reference-section.html#jetty-xml-ref" title="<Ref>">Ref element</a>, |
| <a class="link" href="reference-section.html#jetty-xml-array" title="<Array>">Array element</a>, <a class="link" href="reference-section.html#jetty-xml-map" title="<Map>">Map element</a>, |
| <a class="link" href="reference-section.html#jetty-xml-property" title="<Property>">Property element</a></p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_examples_8"></a>Examples</h4></div></div></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a name="_basic_example_6"></a>Basic example</h5></div></div></div><p>Use the referenced object as an argument to a method call or constructor:</p><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code><Get id="foo" name="xFoo" /> |
| <Set name="test"><Ref refid="foo"/></Set></code></pre><p>This is equivalent to:</p><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code>foo = getXFoo(); |
| setSomeMethod(foo);</code></pre></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a name="_manipulating_the_object_returned_by_ref"></a>Manipulating the Object Returned by Ref</h5></div></div></div><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code><Get id="foo" name="xFoo" /> |
| <Ref refid="foo"> |
| <Set name="test">1, 2, 3</Set> |
| </Ref></code></pre><p>This is equivalent to:</p><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code>foo = getXFoo(); |
| foo.setTest("1, 2, 3");</code></pre></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a name="_ref_vs_nested_elements"></a>Ref vs. Nested Elements</h5></div></div></div><p>Here is an example of the difference in syntax between using the <code class="literal">Ref</code> element, and nesting method calls. |
| They are exactly equivalent:</p><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code><!-- using Ref in conjunction with Get --> |
| <Configure id="Server" class="org.eclipse.jetty.server.Server"> |
| <Get id="Logger" class="org.eclipse.jetty.util.log.Log" name="log"/> |
| <Ref refid="Logger"> |
| <Set name="debugEnabled">true</Set> |
| </Ref> |
| </Configure> |
| <!-- calling the setter directly on the object returned by Get --> |
| <Configure id="Server" class="org.eclipse.jetty.server.Server"> |
| <Get class="org.eclipse.jetty.util.log.Log" name="log"> |
| <Set name="debugEnabled">true</Set> |
| </Get> |
| </Configure></code></pre><p>Here is a more practical example, taken from the handler configuration section in <code class="literal">etc/jetty.xml</code>:</p><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code><Set name="handler"> |
| <New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection"> |
| <Set name="handlers"> |
| <Array type="org.eclipse.jetty.server.Handler"> |
| <Item> |
| <!-- create a new instance of a ContextHandlerCollection named "Contexts" --> |
| <New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/> |
| </Item> |
| <Item> |
| <New id="DefaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler"/> |
| </Item> |
| <Item> |
| <!-- create a new instance of a RequestLogHandler named "RequestLog" --> |
| <New id="RequestLog" class="org.eclipse.jetty.server.handler.RequestLogHandler"/> |
| </Item> |
| </Array> |
| </Set> |
| </New> |
| </Set> |
| |
| <Call name="addBean"> |
| <Arg> |
| <New class="org.eclipse.jetty.deploy.ContextDeployer"> |
| <!-- pass in the ContextHandlerCollection object ("Contexts") that was created earlier, as an argument --> |
| <Set name="contexts"><Ref refid="Contexts"/></Set> |
| </New> |
| </Arg> |
| </Call> |
| |
| <!-- configure the RequestLogHandler object ("RequestLog") that we created earlier --> |
| <Ref refid="RequestLog"> |
| .... |
| </Ref></code></pre></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="jetty-xml-array"></a><Array></h3></div></div></div><p>An <code class="literal">Array</code> element allows the creation of a new array.</p><div class="informaltable"><table class="informaltable" border="1"><colgroup><col class="col_1"><col class="col_2"><col class="col_3"></colgroup><thead><tr><th align="left" valign="top">Attribute</th><th align="left" valign="top">Required</th><th align="left" valign="top">Description</th></tr></thead><tbody><tr><td align="left" valign="top"><p>type</p></td><td align="left" valign="top"><p>no</p></td><td align="left" valign="top"><p>specify what types of items the array can contain.</p></td></tr><tr><td align="left" valign="top"><p>id</p></td><td align="left" valign="top"><p>no</p></td><td align="left" valign="top"><p>unique identifier you can use to refer to the array later.</p></td></tr></tbody></table></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_can_contain_9"></a>Can Contain</h4></div></div></div><p><a class="link" href="reference-section.html#jetty-xml-item" title="<Item>">Item element</a></p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_example_3"></a>Example</h4></div></div></div><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code><Array type="java.lang.String"> |
| <Item>value0</Item> |
| <Item><New class="java.lang.String"><Arg>value1</Arg></New></Item> |
| </Array></code></pre><p>This is equivalent to:</p><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code>String[] a = new String[] { "value0", new String("value1") };</code></pre></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="jetty-xml-item"></a><Item></h3></div></div></div><p>An <code class="literal">Item</code> element defines an entry for Array and Map elements.</p><div class="informaltable"><table class="informaltable" border="1"><colgroup><col class="col_1"><col class="col_2"><col class="col_3"></colgroup><thead><tr><th align="left" valign="top">Attribute</th><th align="left" valign="top">Required</th><th align="left" valign="top">Description</th></tr></thead><tbody><tr><td align="left" valign="top"><p>type</p></td><td align="left" valign="top"><p>no</p></td><td align="left" valign="top"><p>force the types of value.</p></td></tr><tr><td align="left" valign="top"><p>id</p></td><td align="left" valign="top"><p>no</p></td><td align="left" valign="top"><p>unique identifier that you can use to refer to the array later.</p></td></tr></tbody></table></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_can_contain_10"></a>Can Contain</h4></div></div></div><p><a class="link" href="reference-section.html#jetty-xml-get" title="<Get>">Get element</a>, <a class="link" href="reference-section.html#jetty-xml-call" title="<Call>">Call element</a>, |
| <a class="link" href="reference-section.html#jetty-xml-new" title="<New>">New element</a>, <a class="link" href="reference-section.html#jetty-xml-ref" title="<Ref>">Ref element</a>, |
| <a class="link" href="reference-section.html#jetty-xml-array" title="<Array>">Array element</a>, <a class="link" href="reference-section.html#jetty-xml-map" title="<Map>">Map element</a>, |
| <a class="link" href="reference-section.html#jetty-xml-system-property" title="<SystemProperty>">System Property element</a>, |
| <a class="link" href="reference-section.html#jetty-xml-property" title="<Property>">Property element</a></p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="jetty-xml-map"></a><Map></h3></div></div></div><p>A <code class="literal">Map</code> element allows the creation of a new HashMap and to populate it with <code class="literal">(key, value)</code> pairs.</p><div class="informaltable"><table class="informaltable" border="1"><colgroup><col class="col_1"><col class="col_2"><col class="col_3"></colgroup><thead><tr><th align="left" valign="top">Attribute</th><th align="left" valign="top">Required</th><th align="left" valign="top">Description</th></tr></thead><tbody><tr><td align="left" valign="top"><p>id</p></td><td align="left" valign="top"><p>no</p></td><td align="left" valign="top"><p>unique identifier you can use to refer to the map later.</p></td></tr></tbody></table></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_can_contain_11"></a>Can Contain</h4></div></div></div><p><a class="link" href="reference-section.html#jetty-xml-entry" title="<Entry>">Entry element</a></p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_example_4"></a>Example</h4></div></div></div><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code><Map> |
| <Entry> |
| <Item>keyName</Item> |
| <Item><New class="java.lang.String"><Arg>value1</Arg></New></Item> |
| </Entry> |
| </Map></code></pre><p>This is equivalent to:</p><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code>Map m = new HashMap(); |
| m.put("keyName", new String("value1"));</code></pre></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="jetty-xml-entry"></a><Entry></h3></div></div></div><p>An <code class="literal">Entry</code> element contains a key-value <a class="link" href="reference-section.html#jetty-xml-item" title="<Item>">Item element</a> pair for a <code class="literal">Map</code>.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_can_contain_12"></a>Can Contain</h4></div></div></div><p><a class="link" href="reference-section.html#jetty-xml-item" title="<Item>">Item element</a></p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="jetty-xml-system-property"></a><SystemProperty></h3></div></div></div><p>A <code class="literal">SystemProperty</code> element gets the value of a JVM system property. |
| It can be used within elements that accept values, such as <code class="literal">Set</code>, <code class="literal">Put</code>, <code class="literal">Arg</code>.</p><div class="informaltable"><table class="informaltable" border="1"><colgroup><col class="col_1"><col class="col_2"><col class="col_3"></colgroup><thead><tr><th align="left" valign="top">Attribute</th><th align="left" valign="top">Required</th><th align="left" valign="top">Description</th></tr></thead><tbody><tr><td align="left" valign="top"><p>name</p></td><td align="left" valign="top"><p>yes</p></td><td align="left" valign="top"><p>property name</p></td></tr><tr><td align="left" valign="top"><p>default</p></td><td align="left" valign="top"><p>no</p></td><td align="left" valign="top"><p>a default value as a fallback</p></td></tr><tr><td align="left" valign="top"><p>id</p></td><td align="left" valign="top"><p>no</p></td><td align="left" valign="top"><p>unique identifier which you can use to refer to the array |
| later.</p></td></tr></tbody></table></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_can_contain_13"></a>Can Contain</h4></div></div></div><p>Only attributes as Elements (<code class="literal">Id</code>, <code class="literal">Name</code>, <code class="literal">Default</code>).</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_example_5"></a>Example</h4></div></div></div><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code><SystemProperty name="jetty.http.port" default="8080"/></code></pre><p>That is equivalent to:</p><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code>System.getProperty("jetty.http.port", "8080");</code></pre><p>Both try to retrieve the value of <code class="literal">jetty.http.port</code>. |
| If <code class="literal">jetty.http.port</code> is not set, then 8080 is used.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="jetty-xml-property"></a><Property></h3></div></div></div><p>A <code class="literal">Property</code> element allows arbitrary properties to be retrieved by name. |
| It can contain a sequence of elements, such as <code class="literal">Set</code>, <code class="literal">Put</code>, <code class="literal">Call</code> that act on the retrieved object.</p><div class="informaltable"><table class="informaltable" border="1"><colgroup><col class="col_1"><col class="col_2"><col class="col_3"></colgroup><thead><tr><th align="left" valign="top">Attribute</th><th align="left" valign="top">Required</th><th align="left" valign="top">Description</th></tr></thead><tbody><tr><td align="left" valign="top"><p>name</p></td><td align="left" valign="top"><p>yes</p></td><td align="left" valign="top"><p>property name</p></td></tr><tr><td align="left" valign="top"><p>default</p></td><td align="left" valign="top"><p>no</p></td><td align="left" valign="top"><p>a default value as a fallback</p></td></tr><tr><td align="left" valign="top"><p>id</p></td><td align="left" valign="top"><p>no</p></td><td align="left" valign="top"><p>unique identifier which you can use to refer to the array |
| later.</p></td></tr></tbody></table></div><p>The <code class="literal">Name</code> attribute may be a comma separated list of property names, with the first property name being the "official" name, and the others names being old, deprecated property names that are kept for backward compatibility. |
| A warning log is issued when deprecated property names are used. |
| The <code class="literal">Default</code> attribute contains the value to use in case none of the property names is found.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_can_contain_14"></a>Can Contain</h4></div></div></div><p>The attributes may be expressed as contained Elements (<code class="literal">Id</code>, <code class="literal">Name</code>, <code class="literal">Default</code>).</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_example_6"></a>Example</h4></div></div></div><pre xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><code><Property name="Server"> |
| <Call id="jdbcIdMgr" name="getAttribute"> |
| <Arg>jdbcIdMgr</Arg> |
| </Call> |
| </Property></code></pre></div></div></div></div><script type="text/javascript"> |
| SyntaxHighlighter.all() |
| </script><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ubuntu.html"><i class="fa fa-chevron-left" aria-hidden="true"></i> Previous</a> </td><td width="20%" align="center"><a accesskey="u" href="jetty-ref-guide.html"><i class="fa fa-chevron-up" aria-hidden="true"></i> Top</a></td><td width="40%" align="right"> <a accesskey="n" href="jetty-xml-usage.html">Next <i class="fa fa-chevron-right" aria-hidden="true"></i></a></td></tr><tr><td width="40%" align="left" valign="top">Ubuntu </td><td width="20%" align="center"><a accesskey="h" href="index.html"><i class="fa fa-home" aria-hidden="true"></i> Home</a></td><td width="40%" align="right" valign="top"> Jetty XML Usage</td></tr></table></div><p xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><div class="jetty-callout"> |
| See an error or something missing? |
| <span class="callout"><a href="http://github.com/eclipse/jetty.project">Contribute to this documentation at |
| <span class="website"><i class="fa fa-github" aria-hidden="true"></i> Github!</span></a></span><span style="float: right"><i>(Generated: 2020-03-10)</i></span></div></p></body></html> |