I've a controller class with the following signature:
@Controller
@RequestMapping("/home/users")
public class MaterialsController { ... }
and every method in this controller class starts with the same path variable, that is, {username}
, for example, I've the following method:
@RequestMapping(value = "{username}/mycreations/{coursewareName}/materials/{materialId}", method = RequestMethod.DELETE)
public void deleteCourseMaterialFromCreatedCourseware(@PathVariable String username,
@PathVariable String coursewareName, @PathVariable String materialId, Model model,
HttpServletRequest request, HttpServletResponse response) {
Now, it's a little bit tedious to write {username}
at the beginning of each of these controller's methods. Is there a way to specify this path variable at class level? Of course I also need to access it then, like in the same way I'm specifying @PathVariable String username
in the method above.
Also, I ideally, I would like also to include at class-level more than one variable, when necessary.