Using latest spark-core. I am trying to setup a simple GET call.
http://localhost:9346/update/?adasd=123
I am have the following in my main method:
get("/update/", (request, response) -> request.params().toString());
If I execute my call I get {}
, so it appears as if the parameters are empty.
I also tried /update/:adasd
.
This is my first look at spark-java, so I might be getting something basic wrong here.
I just want to be able to read the parameters.
You are mixing things up. You are passing queryParameters but trying to print pathParameters.
For this call:
http://localhost:9346/update?adasd=123
Code like this is required:
get("update", (request, response) -> request.queryParams());
A call to this endpoint will result in this output:
[adasd]