Reply To: How to get property in HttpCondition?

Splash Forums Rewrite Users How to get property in HttpCondition? Reply To: How to get property in HttpCondition?

#26446

cilf
Participant

Good to know I can get the properties in condition evaluation after all.

I think I was looking for something like .constrainedBy:


.addRule()
.when(Direction.isInbound().and(Path.matches("/{artistUrl}")))
.perform(Forward.to("/404.xhtml"), Response.setStatus(404))
.where("artistUrl").constrainedBy(new Constraint<String>() {
    @Override
    public boolean isSatisfiedBy(Rewrite rewrite, EvaluationContext evaluationContext, String s) {
        if (s.contains(".xhtml")) {
            return false;
        }

        Artist artist = artistService.findByUrl(s);
        if (artist == null) {
            return true;
        }

        return false;

    }
}).bindsTo(El.property("errorPage.artistUrl"))

Can you perhaps recommend some source of useful examples? Other than examples and forum sections in here.
Cheers