thekid/rfc — Issue #157: RFC 0157: Make product, language and session optional URL parts
Author: thekid
Created: 2011-10-09 15:28:32+00:00
State: open

Scope of Change
====
Make product, language and session an option URL part for XP
applications that use XMLScriptlet.

Rationale
====
Every setup includes a default product and a default language
which can be used when no value has been passed through the URL.

Many applications do not have more than one product or more than
one language, so always passing it is overhead.
In case non-default values are chosen, they'll again be passed
through the known URL format.

Functionality
====
Parsing product, language and session information will no longer
be done through Apache rewrite rules but within the scriptlet API
itself.
A regular expression is used to parse the string and this expression
needs to be flexible enough to detect omitted values.

Apache setup will be simpler as the required rewrite rule is
much simpler.

The new RewriteRule
----
Since the product and language parts of the URL are optional now, you
need to update the scriptlet RewriteRule accordingly.

Old rewrite rule:
----

```
# Complicated regex inside apache config
RewriteRule ^/xml/(([a-zA-Z]+)[.:;]([a-zA-Z_]+)([.:;]psessionid=([0-9A-Za-z]+))?/)?([a-zA-Z/]+)$ /index.php [E=PRODUCT:$2,E=LANGUAGE:$3,E=SESS:$5,E=STATE:$6,PT]
.

```

New rewrite rule:
----

```
# {{{ Parsing handled by scriptlet API
RewriteRule ^/xml /index.php [PT]
.

```

Security considerations
====
n/a

Speed impact
====
Should have no impact.

Dependencies
====
n/a

Related documents
====
- http://xp-framework.net/rfc/contrib/rfc0157.diff
Implementing patch

Comments
====