chkal/pf-issue-test — Issue #126: Parent mappings that accept ANY path have their matched path segment set to the viewId
Author: chkal
Created: 2012-03-06 07:41:08+00:00
State: open

Originally filed by **arjan.va...@chess-ix.com** on 2012-02-22T14:59:01

Google Code issue: http://code.google.com/p/prettyfaces/issues/detail?id=128

What steps will reproduce the problem?

1. Define a parent mapping that accepts anything in its pattern. Like one of:

@URLMapping(id = "parent", pattern = "/#{parent.path}", viewId = "/index.xhtml")
@URLMapping(id = "parent", pattern = "/ /.*/ #{parent.path}", viewId = "/index.xhtml")
@URLMapping(id = "parent", pattern = "/ /[^/]*/ #{parent.path}", viewId = "/index.xhtml")

2. Define a child mapping that refers to that. Like:

@URLMapping(id = "child", pattern = "/#{child.path}", viewId = "/index.xhtml", parentId = "parent")

3. For any URL see that the match for the parent is set to the viewId, rather than the actual matched path segment. Also, the child does not get any path set.

Like for the attached example, with http://localhost:8765/abc/123
#{parent.path} is set to "index.xhtml"
#{child.path} is not set

What is the expected output?

#{parent.path} is set to "abc"
#{child.path} is set to "123"

Note that all works as expected for a mapping that somehow limits the pattern, like by using some prefix, or by using some regex that does not accept just anything:

@URLMapping(id = "parent", pattern = "/some-prefix-#{parent.path}", viewId = "/index.xhtml")
@URLMapping(id = "parent", pattern = "/#{ /[a-zA-Z0-9-]*/ parent.path}", viewId = "/index.xhtml")

PrettyFaces 2.3.2

Attached sample can be run using:

mvn clean compile jetty:run
http://localhost:8765/abc/123