I have created the following small test application:
public static void main(String... args) {
Pippo pippo = new Pippo();
pippo.GET("/hello/", routeContext -> {
routeContext.getResponse().ok();
throw new RuntimeException("Ouch");
});
pippo.ALL("/.*", routeContext -> {
routeContext.getResponse().header("Cache-Control", "no-cache, no-store, must-revalidate");
routeContext.getResponse().header("Pragma", "no-cache");
routeContext.getResponse().header("Expires", "0");
routeContext.next();
System.out.println("Filter processed.");
}).runAsFinally();
pippo.start();
}
Which results in the following output when doing a GET on /hello/:
2017-02-07T09:07:50.438Z [XNIO-1 task-1] INFO ro.pippo.core.PippoFilter - Pippo started (PROD)
2017-02-07T09:07:50.452Z [XNIO-1 task-1] ERROR ro.pippo.core.DefaultErrorHandler - Ouch
java.lang.RuntimeException: Ouch
at com.gamblify.burgundy.content.Main.lambda$0(Main.java:22) ~[classes/:na]
at ro.pippo.core.route.DefaultRouteContext.handleRoute(DefaultRouteContext.java:352) ~[pippo-core-1.1.0.jar:na]
...
Filter processed.
As the output shows the "/.*" filter is correctly called. The changes to the response is however ignored and so the HTTP headers are not added.
I have created the following small test application:
Which results in the following output when doing a GET on /hello/:
As the output shows the "/.*" filter is correctly called. The changes to the response is however ignored and so the HTTP headers are not added.