I am trying to create a filter that matches the following URL:
/foo and /foo/*
So everything under /foo/ as well as the base case /foo
I have this filter:
Spark.before("/foo/*", (request, response) -> { String ticket = request.cookie("session"); if (ticket == null) { Spark.halt(302); } });
But of course this fails when I enter /foo
I tried the following but no luck:
/foo* /foo.* /foo/
Anyway, for this? Or maybe use a list of URLs? so that I can assign both url to the same filter.
And please donβt say to save the function in a variable so that I use it twice, because I think it is not at all clean.
java url-routing spark-java
Pablo Matias Gomez
source share