I need to handle requests as following:
www.example.com/show/abcd/efg?name=alex&family=moore (does not work)
www.example.com/show/abcdefg?name=alex&
The first one is not working because you are trying to handle an entirely new URL which is not actually mapped your controller.
www.example.com/show/abcd/efg?name=alex&family=moore (does not work)
The correct mapping for the above URL could be like the below code.
@RequestMapping(value = {"/{mystring:.*}" , "/{mystring:.*}/{mystring2:.*}"}, method = RequestMethod.GET)
public String handleReqShow(
@PathVariable String mystring,
@PathVariable String mystring2,
@RequestParam(required = false) String name,
@RequestParam(required = false) String family, Model model) {
I have tried the similar concept when my one controller is used to handle multiple types of request.