Skip to content

Conversation

wolfgangmm
Copy link
Member

Work in progress, do not merge yet.

@duncdrum duncdrum added the Rewrite Article needs a complete do over label Jun 3, 2018
@duncdrum
Copy link
Contributor

is this still WIP?

@duncdrum duncdrum requested a review from a team January 1, 2019 20:16
@adamretter
Copy link
Contributor

@duncdrum Afraid I am not sure I can help with the content of this... URL Rewriting is not my area of expertise.

Copy link
Contributor

@lguariento lguariento left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great :) !

short and human-readable URIs instead.</para>
<para>Let's contemplate the following scenario: the XML documents your app should display through a web page are contained in a sub-collection
called <code>data</code>. For example, the document you are currently reading resides in <code>data/urlrewrite.xml</code> within the documentation collection. The direct URL pointing to this document would thus be <code>/exist/apps/doc/data/urlrewrite.xml</code>. We do not want to show the user the raw XML though. Instead users should get a properly formatted HTML version of the text, accessible through a simple URL like <code>/exist/apps/doc/urlrewrite</code>.</para>
<para>To achieve this we need a mechanism to map or rewrite a given URL to an application specific endpoint. So in the simplest case, calling
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

application-specific

<para>For example, one may want to direct all requests to <literal>/exist/apps/doc/{resource}</literal> to an XQuery, <literal>transform.xql</literal>, which is responsible for converting the XML content into HTML:</para>
<programlisting xmlns:xlink="http://www.w3.org/1999/xlink" language="xquery" xlink:href="listings/listing-1.txt"/>
<para>This example controller returns a simple <tag>dispatch</tag> fragment only. This fragment will be passed back to the URL rewriting framework once the controller XQuery has been executed. The <tag>forward</tag> element instructs the framework to call the URL <literal>modules/transform.xql</literal> relative to the collection in which the controller resides. It adds a request parameter, named <literal>doc</literal>, which translates the requested resource into an actual document path to be transformed by <literal>modules/transform.xql</literal>.</para>
<para>Real world controllers are typically more complicated and may contain arbitrary XQuery code to distinguish between different scenarios. Basically, the URL rewriting framework allows you to turn simple requests into complex processing pipelines, involving any number of steps. For example, let us split above <tag>dispatch</tag> fragment into a pipeline involving two steps:</para>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"let us split the above"

@@ -0,0 +1,13 @@
xquery version "3.0";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not 3.1, while we're at it?

@adamretter
Copy link
Contributor

@wolfgangmm What's the status of this?

@joewiz joewiz added this to the 4.1.3 milestone May 21, 2019
@duncdrum duncdrum modified the milestones: 4.1.3, 4.2.1 May 23, 2019
@adamretter
Copy link
Contributor

adamretter commented May 27, 2019

So @wolfgang reports that this is still a WIP as of today.

@duncdrum duncdrum modified the milestones: 4.2.1, 4.x Aug 14, 2019
@duncdrum
Copy link
Contributor

duncdrum commented Jan 27, 2020

see #105
see #200
@wolfgangmm please rebase

@duncdrum duncdrum modified the milestones: 4.x, 5.2.0 Jan 29, 2020
@dizzzz dizzzz marked this pull request as draft October 17, 2020 17:56
@marmoure marmoure mentioned this pull request Jan 16, 2023
@joewiz
Copy link
Member

joewiz commented Mar 19, 2023

Superseded by #872.

@joewiz joewiz closed this Mar 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants