08-02-2023, 02:36 PM
I need to handle requests as following:
It should accept any sort of character from the value that is located between `www.example.com/show/` and `?`. Please note the value that would be located there would be a single value not name of an action.
For example: `/show/abcd/efg` and `/show/lkikf?name=Jack` in which the first request should redirect user to the page `abcd/efg` (because thats a name) and the second one should redirect user to the page `lkikf` along with value of parameter name.
I have following controller to handle it but the issue is when I have / in the address the controller is unable to handle it.
@RequestMapping(value = "/{mystring:.*}", method = RequestMethod.GET)
public String handleReqShow(
@PathVariable String mystring,
@RequestParam(required = false) String name,
@RequestParam(required = false) String family, Model model) {
I used following regex which did not work.
/^[ A-Za-z0-9_@./#&+-]*$/
[To see links please register here]
(does not work)[To see links please register here]
(works)[To see links please register here]
(works)It should accept any sort of character from the value that is located between `www.example.com/show/` and `?`. Please note the value that would be located there would be a single value not name of an action.
For example: `/show/abcd/efg` and `/show/lkikf?name=Jack` in which the first request should redirect user to the page `abcd/efg` (because thats a name) and the second one should redirect user to the page `lkikf` along with value of parameter name.
I have following controller to handle it but the issue is when I have / in the address the controller is unable to handle it.
@RequestMapping(value = "/{mystring:.*}", method = RequestMethod.GET)
public String handleReqShow(
@PathVariable String mystring,
@RequestParam(required = false) String name,
@RequestParam(required = false) String family, Model model) {
I used following regex which did not work.
/^[ A-Za-z0-9_@./#&+-]*$/