Re: Rewrite – Ignore a request that mathches a pattern.

Splash Forums PrettyFaces Users Rewrite – Ignore a request that mathches a pattern. Re: Rewrite – Ignore a request that mathches a pattern.

#23046

Hey,

nice to hear you are interested in Rewrite. For a start I recommend to have a look at the homepage:

Rewrite

And also look at the examples:

Rewrite Examples

For your usecase a rule like this should do the job:

.addRule(
Join.path("/{key}").to("/index.xhtml")
.where("key").matches("[a-zA-Z]{32}").bindsTo(El.property("bean.key"))
.perform(Invoke.binding(El.retrievalMethod("bean.load")))
)

I think it is very self explaining.

However, the 32 character restriction can also be implemented in PrettyFaces. It’s very easy. You can use a custom regex for this:

<url-mapping id="load">
<pattern value="/#{ /[a-zA-Z]{32}/ key : bean.key }" />
<view-id value="/index.xhtml" />
<action>#{bean.load}</action>
</url-mapping>

See the PrettyFaces documentation for details:

http://ocpsoft.org/docs/prettyfaces/3.3.3/en-US/html/Configuration.html#config.pathparams.regex

I hope this helps. :)

Christian