Reply To: encodeURL invokes Operations

Splash Forums Rewrite Users encodeURL invokes Operations Reply To: encodeURL invokes Operations

#24893

Actually a Join is a special rule which consists of an inbound and an outbound part. Take this for an example:

Join.path("/home").to("/faces/home.xhtml")

This is basically the same as:

.addRule()
.when(Direction.isInbound().and(Path.matches("/home")))
.perform(Forward.to("/faces/home.xhtml"))
.addRule()
.when(Direction.isOutbound().and(Path.matches("/faces/home.xhtml")))
.perform(Substitute.with("/home"))

And there are other use cases for outbound rewriting. Take CDNs for an example. Let’s imagine you want to achieve that clients don’t fetch jQuery from your local server but instead from a CDN. You can do this with Rewrite, even for stuff like JSF resources:

.addRule()
.when( Direction.isOutbound().and(Path.matches("/faces/javax.faces.resource/jquery.js")) )
.perform( Substitute.with("http://dh8sm43.cloudfront.net/jquery.js") )

If you want to learn a bit more about these basics, you could have a look at the slides of my Rewrite talk on JAX13: