I might need your help to understand why my Java Spring code is not working.
I have a HTTP Get Method, in which I'd like to pass two request parameters. While the first parameter is passed perfectly fine, the second one is always null or empty.
This is what the beginning of the Method looks like.
@RequestMapping(value = "/session/{sessionID}", method = RequestMethod.GET)
public ResponseEntity<List<SensordataDTO>> getSensordataBySessionID(
@PathVariable("sessionID") long sessionID,
@RequestParam(required = false, name = "startSequence") Optional<Long> startSequence,
@RequestParam(required = false, name = "endSequence") Optional<Long> endSequence) {
I tried different types for the RequestParam like long, Long and Optional. I also tried to specify the default value =, name =, value = parameters in the @RequestParam annotation. But no matter what, the second parameter in the url is always null / empty string.
In case I do something wrong with the url itself, I formated it this way:
"/session/1?startSequence=4&?endSequence=6"
I hope you have an idea what I am missing.