0

i am using this function for get request param spring3 mvc and my url is

localhost:8080/karmaFriend/register/abc/wq/abc@abc.com

@RequestMapping(value = "/register/{username}/{password}/{email}",  method = RequestMethod.GET)

public @ResponseBody ResponseMsg getUserInJSON(@PathVariable String username, @PathVariable String password, @PathVariable String email) {
        ResponseMsg responseMsg = CommonUtils.checkParam(username, password, email);
        if(responseMsg.getStatus().equalsIgnoreCase("True"))
            responseMsg =  userService.registerUser(username, password, email);
        return responseMsg;
    }

it works good but if i change my url like this localhost:8080/karmaFriend/register/abc//abc@abc.com

then it will not call to that function ... is there any other way to call same function ??

Er KK Chopra
  • 1,834
  • 8
  • 31
  • 55
  • it seems that you need to write a different method: http://stackoverflow.com/a/4904139/322166 – Dani Mar 13 '13 at 13:56
  • I am not sure why you would want to register someone without a username, but you can use regular expressions in your path variables. Try changing username to "{username:^[\pL\pN\p{Pc}]*$}", which will hopefully gobble up 0 or more alpha-numerics with underscore characters. You may have to play with the regex a bit. – CodeChimp Mar 14 '13 at 12:34

0 Answers0