I have a complex bean holding the rest parameters, eg:
public class MyRestParams {
private HttpServletRequest req;
private @NotBlank String name;
//getter, setter
}
Usage:
@RestController
@RequestMapping("/xml")
public class MyServlet {
@RequestMapping(value = "/")
public void getTest(@Valid MyRestParams p) {
Sysout(p.getName()); //works when invoked with /xml?name=test
Sysout(p.getReq()); //always null
}
}
Problem: the HttpServletRequest
is always null. Isn't it possible to add this parameter within the bean itself?