How to get the request parameters using get in Spark Java framework?
If you have an URL like : http://localhost:4567/smartapp/getDataViewModelConfig/456 use the following code :
get("/smartapp/getDataViewModelConfig/:id","application/json", ((request, response) -> {
response.type("application/json")
return request.params(":id");
}), gson::toJson);
If you have to work with an URL like /smartapp/getDataViewModelConfig?collId=123
you have to deal with query parameters in your implementation, like the following:
get("smartapp/getDataViewModelConfig", "application/json", (request, response)->{
String id = request.queryParams("collId");
return "HI " + id;
}