使用HttpServletRequest时出错

时间:2015-01-22 06:27:58

标签: servlets

我想检索我的服务中的请求数据,这些数据是在web中使用restangular调用的。所以我已经自动装配了HttpServletRequest,但是当我试图获取数据时,我收到以下错误:

{"errors":[{"code":"FATAL_ERROR","type":"ERROR","message":"Current request is not a servlet request"}],"status":"ERROR","errorCode":500,"errorStatus":"INTERNAL_SERVER_ERROR"}

我的代码如下:

@Autowired
HttpServletRequest httpServletRequest;
@Path("/user")
public class UserController {

@Autowired
    HttpServletRequest httpServletRequest;
    @POST
    @Path("/userDetails")
    @Produces(MediaType.APPLICATION_JSON)
    public Response
    getUserDetails() {
    System.out.printl(httpServletRequest;);

0 个答案:

没有答案