public Optional<RestxHandlerMatch> match(RestxRoute route) {
// here we decide to apply the filter or not based on the route class.
// but we could decide on any route property, for instance relying on the fact that routes generated
// by @{GET,POST,PUT,DELETE} are always StdEntityRoute instances and their matcher always StdRouteMatcher
if (route instanceof ExampleRoute) {
return Optional.of(new RestxHandlerMatch(new StdRestxRequestMatch("/route/filter"), new RestxHandler() {
@Override
public void handle(RestxRequestMatch match, RestxRequest req, RestxResponse resp, RestxContext ctx) throws IOException {
resp.getWriter().write(">>");
ctx.nextHandlerMatch().handle(req, resp, ctx);
resp.getWriter().write("<<");