Re: time condition in rewrite rule along with other rules

Splash Forums Rewrite Users time condition in rewrite rule along with other rules Re: time condition in rewrite rule along with other rules

#22273

Yes, you could create different configuration with different priorities to separate the rules. This totally makes sense if you have completely independent configurations.

If you don’t want to use JodaTime for this, you could implement a matching condition yourself. Something like:

return ConfigurationBuilder.begin()
.defineRule()
.when(Direction.isInbound().and(Path.matches("{page}").where("page").matches(".*"))
.and(new Condition() {
@Override
public boolean evaluate(Rewrite rewrite, EvaluationContext ctx)
{
// do whatever you want
}
}))
.perform(Redirect.temporary("/myapp/{page}"));

Just return true if you want the condition to match and false otherwise.