What is the difference between @RequestParam
and @PathVariable
while handling special characters?
+
was accepted by @Re
@PathVariable - must be placed in the endpoint uri and access the query parameter value from the request
@RequestParam - must be passed as method parameter (optional based on the required property)
http://localhost:8080/employee/call/7865467
@RequestMapping(value=“/call/{callId}", method = RequestMethod.GET)
public List getAgentCallById(
@PathVariable(“callId") int callId,
@RequestParam(value = “status", required = false) String callStatus) {
}
http://localhost:8080/app/call/7865467?status=Cancelled
@RequestMapping(value=“/call/{callId}", method = RequestMethod.GET)
public List getAgentCallById(
@PathVariable(“callId") int callId,
@RequestParam(value = “status", required = true) String callStatus) {
}