If I formalize my method like this:
@GetMapping("/dl4j/getWordVector")
public ResponseEntity<List<Double[]>> getWordVector(String modelName, String word) {
// ...
}
and leave out a paramter, I will not see a MissingServletRequestParameterException
. This works only if I use @RequestParam
:
@GetMapping("/dl4j/getWordVector")
public ResponseEntity<List<Double[]>> getWordVector(@RequestParam(value="modelName", required = true) String modelName, String word) {
// ...
}
Why is this the case? Imho it should be a opt-out since I guess most of the parameters in a REST Api are required, are they not?