It's also about spark routing. It's a small amount, so I have to put it together soon.
If you set the path "/ sample / *", it will match the following URL.
/sample/
/sample/hello
/sample/hello/
/sample/hello/*
It does not match below.
/sample
When using the path parameter, it is necessary to set the matching in filter as well.
Bad sauce
python
public static void main(String[] args) {
before((request, response) -> {
system.out.println(request.params("name")); //null is displayed
});
get("/:name", (request, respoonse) -> request.params("name"));
}
Cool sauce
python
public static void main(String[] args) {
before("/:name", (request, response) -> {
system.out.println(request.params("name")); //The content specified in the url is displayed
});
get("/:name", (request, respoonse) -> request.params("name"));
}
It feels a bit redundant.
Recommended Posts