Skip to content

Commit 43de036

Browse files
committed
Move inline programlistings into includes
1 parent 06ef4fb commit 43de036

File tree

9 files changed

+25
-17
lines changed

9 files changed

+25
-17
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<ignore xmlns="http://exist.sourceforge.net/NS/exist"/>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<dispatch xmlns="http://exist.sourceforge.net/NS/exist">
2+
<redirect url="..."/>
3+
</dispatch>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<dispatch xmlns="http://exist.sourceforge.net/NS/exist">
2+
<forward url="{$exist:controller}/modules/transform.xq">
3+
<add-parameter name="doc" value="{$exist:resource}.xml"/>
4+
</forward>
5+
</dispatch>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<add-parameter name="xxx" value="yyy"/>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<set-attribute name="xxx" value="yyy"/>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<clear-attribute name="xxx">
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<set-header name="xxx" value="yyy"/>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<dispatch xmlns="http://exist.sourceforge.net/NS/exist">
2+
<redirect url="..."/>
3+
<cache-control cache="yes"/>
4+
</dispatch>

src/main/xar-resources/data/urlrewrite/urlrewrite.xml

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
useful for requests to fixed resources like images or stylesheets. An alternative may be to
132132
handle requests for such resources separately from the <code>XQueryUrlRewrite</code>
133133
servlet; this is discussed in <xref linkend="controller-mappings"/>.</para>
134-
<programlisting language="xml">&lt;ignore xmlns="http://exist.sourceforge.net/NS/exist"/&gt;</programlisting>
134+
<programlisting language="xml" xlink:href="listings/listing-14.xml"/>
135135
<para>The <tag>ignore</tag> element may include an optional <link linkend="cache-control"><literal>cache-control</literal></link> element.</para>
136136
</sect2>
137137
<sect2 xml:id="redirect">
@@ -143,9 +143,7 @@
143143
request, and this can potentially trigger the controller again; care must be taken to avoid
144144
creaing an un-exitable loop.</para>
145145
<para>The URL to the <literal>redirect</literal> element is given in an attribute named <literal>url</literal>.</para>
146-
<programlisting language="xml">&lt;dispatch xmlns="http://exist.sourceforge.net/NS/exist"&gt;
147-
&lt;redirect url="..."/&gt;
148-
&lt;/dispatch&gt;</programlisting>
146+
<programlisting language="xml" xlink:href="listings/listing-15.xml"/>
149147
<para>A redirect will be visible to the user: for instance the user's web-browser will be
150148
updated to show the specified new URL.</para>
151149
</sect2>
@@ -205,11 +203,7 @@
205203
</listitem>
206204
</varlistentry>
207205
</variablelist>
208-
<programlisting language="xml">&lt;dispatch xmlns="http://exist.sourceforge.net/NS/exist"&gt;
209-
&lt;forward url="{$exist:controller}/modules/transform.xq"&gt;
210-
&lt;add-parameter name="doc" value="{$exist:resource}.xml"/&gt;
211-
&lt;/forward&gt;
212-
&lt;/dispatch&gt;</programlisting>
206+
<programlisting language="xml" xlink:href="listings/listing-16.xml"/>
213207
<para>The <tag>forward</tag> element can contain the optional child elements: <link
214208
linkend="add-parameter"><literal>add-parameter</literal></link>, <link
215209
linkend="set-attribute"><literal>set-attribute</literal></link>, <link
@@ -230,7 +224,7 @@
230224
Parameter.</para>
231225
<para>The name of the parameter is taken from the <literal>name</literal> attribute, and the
232226
value from the <literal>value</literal> attribute.</para>
233-
<programlisting language="xml">&lt;add-parameter name="xxx" value="yyy"/&gt;</programlisting>
227+
<programlisting language="xml" xlink:href="listings/listing-17.xml"/>
234228
<para>The original HTTP request will be copied before the change is applied. This applies only
235229
to the step on which it is placed, that is to say that subsequent steps in the pipeline will
236230
not see the parameter. </para>
@@ -242,7 +236,7 @@
242236
they and are not related to the HTTP Request or HTTP Response.</para>
243237
<para>The name of the request attribute is read from the <literal>name</literal> attribute,
244238
and the value from the <literal>value</literal> attribute.</para>
245-
<programlisting language="xml">&lt;set-attribute name="xxx" value="yyy"/&gt;</programlisting>
239+
<programlisting language="xml" xlink:href="listings/listing-18.xml"/>
246240
<para>You can set arbitrary request attributes, for instance to pass information between
247241
XQuery modules. Some attribute names may be reserved by various servlets in the
248242
pipeline.</para>
@@ -251,7 +245,7 @@
251245
<para>The <tag>clear-attribute</tag> option clears a request attribute.</para>
252246
<para>The name of the request attribute is read from the <literal>name</literal>
253247
attribute.</para>
254-
<programlisting language="xml">&lt;clear-attribute name="xxx"/&gt;</programlisting>
248+
<programlisting language="xml" xlink:href="listings/listing-19.xml"/>
255249
<para>Unlike parameters, request attributes will be visible to subsequent steps in the
256250
processing pipeline. They only need to be explicitly cleared once they are no longer needed
257251
by the user. eXist-db places no requirement on the user having to ever clear the
@@ -260,7 +254,7 @@
260254
<para>The <tag>set-header</tag> option sets an HTTP Response Header field.</para>
261255
<para>The name of the header is read from the <literal>name</literal> attribute, and the value
262256
from the <literal>value</literal> attribute.</para>
263-
<programlisting language="xml">&lt;set-header name="xxx" value="yyy"/&gt;</programlisting>
257+
<programlisting language="xml" xlink:href="listings/listing-20.xml"/>
264258
<para>The HTTP response is shared between all steps in the pipeline, so all following steps will be able to see the change.</para></sect2>
265259
<sect2 xml:id="cache-control">
266260
<title>The <tag>cache-control</tag> Option</title>
@@ -270,10 +264,7 @@
270264
<para>Internally the URL Rewriting framework maintains a mapping between Input URLs and
271265
Dispatch Rules. When the cache is enabled, the <literal>controller.xq</literal> XQuery Main Module only needs to be
272266
executed once for each distinct input URL. Subsequent requests for the same URL will be served from the cache.</para>
273-
<programlisting language="xml">&lt;dispatch xmlns="http://exist.sourceforge.net/NS/exist"&gt;
274-
&lt;redirect url="..."/&gt;
275-
&lt;cache-control cache="yes"/&gt;
276-
&lt;/dispatch&gt;</programlisting>
267+
<programlisting language="xml" xlink:href="listings/listing-21.xml"/>
277268
<para>Note: only the URL rewrite rule is cached, the HTTP response itself is not cached! The <literal>cache-control</literal> setting is unrelated to any HTTP Cache Headers in the HTTP Response, and is unrelated to any client-side caching within a web-browser.</para>
278269
</sect2>
279270
</sect1>

0 commit comments

Comments
 (0)