Re: Generic URL mapping, is it possible ?

Splash Forums PrettyFaces Users Generic URL mapping, is it possible ? Re: Generic URL mapping, is it possible ?


There are basically two ways to do something like this.

If you want to use the current stable PrettyFaces 3.x, you could implement it using dynaview. Something like this:

<url-mapping id="generic">
<pattern value="/#{ dynaBean.path }" />
<view-id value="#{ dynaBean.getViewId }" />

public class DynaBean {

private String path;

public String getViewId() {
return "/" + path + ".jsf";

/* getters + setters */


Unfortunately there is currently a bug related to dynaview in PrettyFaces 3.3.0 that prevents this from working. But you can use 3.3.1-SNAPSHOT. The bug is fixed in these snapshots.

The other way would be to use the new Rewrite library, which will be the core of PrettyFaces 4.0. Lincoln added a comment regarding this to the post. Unfortunately that is not much documentation for Rewrite at the moment because it is still in development. But you can have a look at the README and some configuration examples to get started.

I hope this helps! :)