Re: Rewrite every *.jsf

Splash Forums PrettyFaces Users Rewrite every *.jsf Re: Rewrite every *.jsf

#20594

Hey Matt,

I was going to write a longer post to answer your question, but my first glance tells me that your assumption is correct; you’re using a regexp that will continually loop –

You might consider using a negative lookahead (or lookbehind) for the purposes of restricting what is actually matched. Unfortunately, we don’t have the concept of *last* yet (it might take some header manipulation/trickery for that to work.)

Negative lookbehind:

(?<!.jsf)

<rewrite match="^([^?]*)/([^?/.]+)(?<!.jsf)(?.*)?$" substitute="$1/$2.jsf$3" redirect="chain"/>

This should prevent matching on URLs that already inclue .jsf.

If this isn’t quite working, you could try the custum rewrite processor:

http://ocpsoft.com/docs/prettyfaces/3.2.0/en-US/html/inbound_rewriting.html

<rewrite processor="com.raible.AddJSFProcessor" inbound="true" />

public class AddJSFProcessor implements com.ocpsoft.pretty.faces.rewrite.Processor
{
public String process(RewriteRule rule, String url)
{
return "new/url/";
}
}

We are currently working on refactoring and improving the processor interface to provide access to the request/response, and also enable more complete control over the prettyfaces lifecycle. So stay tuned for these updates in the next snapshot.

Sorry for the difficulty you’ve been having, we’re coming up to speed slowly but surely :) This is all supposed to be “easy,” but as I’m sure you know, “easy” only comes once you see what many kinds of things people want to do, and design accordingly.

–Lincoln