Reply To: Rewrite conflicts with JSF ImageServlet (h:graphicImage)

Splash Forums Rewrite Users Rewrite conflicts with JSF ImageServlet (h:graphicImage) Reply To: Rewrite conflicts with JSF ImageServlet (h:graphicImage)

#24593

This is because your /image URL matches the Join rule specified. You need to add an exception, like this:

.addRule(Join.path("/{page}").to("/{page}.jsf") )
.when(Not.any(Path.matches("/image")))
.where("page").matches("[a-zA-Z/]+")

This is one way to do it. You could also simply use a more restrictive regex:

.addRule(Join.path("/{page}").to("/{page}.jsf") )
.where("page").matches("(!?image)[a-zA-Z/]+")

Or you could add an additional constraint via Java:

.addRule(Join.path("/{page}").to("/{page}.jsf") )
.where("page")
 .matches("[a-zA-Z/]+")
 .constrainedBy(new Constraint<String>() {
   boolean isSatisfiedBy(Rewrite event, EvaluationContext context, String value) {
     return !string.matches("image")
   }
 })

Hope this helps 🙂