I had a controller that accepted params
@GetMapping(value = "/messages/getReceivedMessage")
public
HttpEntity<ReceivedMessageDTO> getReceivedMessage(
@ApiParam(value = "The message ID", required = true) @RequestParam Long id
)
and I gets the data using an AngularJS in this way
$http({
url: '/messages/getReceivedMessage',
method: "GET",
params: {
id: messageId
}
})
.then(function (response) {
$scope.message = response.data;
if(response.data.date_of_read === null) {
setDateOfRead();
}
})
.catch(function () {
console.log('failed');
});
but now I have decided to change the REST API address and it will accept path variables
@GetMapping(value = "/received/{id}")
public
HttpEntity<ReceivedMessageDTO> getReceivedMessage(
@ApiParam(value = "The message ID", required = true) @PathVariable Long id
)
How I can send path variables to controller?