Path info mapping provides a powerful way to easily support structured path info URLs and receive their values as inputs.
By default however, even if none of the mappings matches the provided pathinfo, the element will be executed. No values will have been extracted from the pathinfo and you're responsible for taking the appropriate action yourself. Usually, this is exactly what you want as a fall back. However, sometimes you might want to have elements that will only be processed if at least one of the declared mappings matches the pathinfo. This can be achieve by setting the "pathinfo" attribute of the element tag to "strict".
For example:
<element id="ShowPaste" implementation="elements.ShowPaste"
url="paste/*" pathinfo="strict">
<pathinfo mapping="$key/show/$id(\d+)"/>
<pathinfo mapping="show/$id(\d+)"/>
</element>
<element id="DiffPastes" implementation="elements.DiffPastes"
url="paste/*" pathinfo="strict">
<pathinfo mapping="$key/diff/$oldid(\d+)/$id(\d+)"/>
<pathinfo mapping="diff/$oldid(\d+)/$id(\d+)"/>
</element>
Both elements above handle the same pathinfo URL. However, only when the "show" keyword is present, the ShowPaste element will be executed and when the "diff" keyword is present the DiffPastes element will be executed.
So these will go to ShowPaste:
- mypaste/show/1232
- show/1232
These will go to DiffPastes:
- mypaste/diff/1221/1244
- diff/241/521
These will however be executed by neither:
- mypaste/show/notanumber
- diff/2141/4421/additionalpart