Question

I have one question. How could pretty faces do this:

<code>
<url-mapping id="home">
    <pattern value="/viewer" />
    <view-id value="/pages/*" />
</url-mapping>
</code>

Well, I wonder if pretty faces could hide paths of all .xhtml in folder using just one configuration as shown as above, instead of to config for each and every file.

Était-ce utile?

La solution

This mapping doesn't make any sense. To which view should PrettyFaces forward if the client requests /viewer?

However, you can do something similar with Rewrite, which is the successor of PrettyFaces. With Rewrite you can do something like:

.addRule( Join.path("/viewer/{page}").to("/pages/{page}.xhtml") )

This will basically map your URLs like this:

  • /viewer/foo -> /pages/foo.xhtml
  • /viewer/bar -> /pages/bar.xhtml
  • /viewer/whatever -> /pages/whatever.xhtml

If you want to migrate your app to Rewrite, which is really simple, have a look at the PrettyFaces Migration Guide.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top