chkal/pf-issue-test — Issue #64: @URLMapping path values gets URL encoded in form's 'action' attribute. (I.e "/" gets URL encoded into "%2F" which gives "400 Invalid URI: noSlash" sever responses on any form action.)
Author: chkal
Created: 2012-03-06 07:26:57+00:00
State: open

Originally filed by **vidar.gr...@tv2.no** on 2010-10-05T20:59:43

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

What steps will reproduce the problem?
Using annotation mapping where "/" characters are part of the pattern, these characters gets URL encoded when output as finished html in which breaks any form action due to "400 Invalid URI: noSlash" server responses.

Example bean annotation:
@Named("nav")
@RequestScoped
@URLMapping(id = "navigationBean", pattern = "/#{/.*/nav.path}/", viewId = "#{nav.getViewPath}", outbound=false)
public class NavigationBean implements Serializable {
private String path;
...

@URLQueryParameter("page")
private Long page;
...
public String getViewPath() {
// at this point "path" contains the URL path as expected, and I can use it ready data and to show the correct view (example of value returned "/faces/section.xhtml" or a 404-viewpath if needed)
...
}
}

This works great for picking up URLs like
/category/
/category/subcategory/
/category/subcategory/a/b/c
etc

However all of the "/" chars gets URL encoded into "%2F" which breaks any form action or ajax request with a server response "400 Invalid URI: noSlash" that prevents the request from ever reaching the web app.

What is the expected output? What do you see instead?
Expected output:

...

What do I see instead:

...

What version of PrettyFaces are you using? On what server and version,
version of JSF, and other relevant technologies?

PrettyFaces 3.1.0
JSF2
Glassfish3 server

Please see forum topic below for more details, more example code and current workaround used that involves manual URL encoding and decoding of the bean field PrettyFaces injects the path-parameter into.
http://ocpsoft.com/support/topic/urlmapping-path-gets-url-encoded-into-in-s