Is it possible to simulate a servlet filter chain using @ApplicationPath and @Path annotations in EE 6?
Example:
@ApplicationPath("/api")
class Filter extends Application {
@Path("/*")
public void filter() {
log.info("Request to API");
}
}
...
@Path("/foo")
class Foo {
@GET
@Path("/bar")
@Produces("text/plain")
public String bar() {
return "Hello World";
}
}
Where the URL would be http://foobar.com/api/foo/bar but the "filter" method would be invoked as if it were a servlet filter chain. I know the approach above wont work but is there an annotated approach in this ilk that would achieve the same as if the "Filter" was configured from web.xml file?