@PathVariable
is used to tell Spring that part of the URI path is a value you want passed to your method. Is this what you want, or are the variables supposed to be form data posted to the URI?
If you want form data, use @RequestParam
instead of @PathVariable
.
If you want @PathVariable
, you need to specify placeholders in the @RequestMapping
entry to tell Spring where the path variables fit in the URI. For example, if you want to extract a path variable called contentId
, you would use:
@RequestMapping(value = "/whatever/{contentId}", method = RequestMethod.POST)
Edit: Additionally, if your path variable could contain a '.' and you want that part of the data, then you will need to tell Spring to grab everything, not just the stuff before the '.':
@RequestMapping(value = "/whatever/{contentId:.*}", method = RequestMethod.POST)
This is because the default behaviour of Spring is to treat that part of the URL as if it is a file extension, and excludes it from variable extraction.