NutzCN Logo
问答 getReader() has already been called for this request
发布于 1583天前 作者 xin-biggod 2387 次浏览 复制 上一个帖子 下一个帖子
标签:
@At
    @Ok("void")
    @POST
    @Api(name = "腾讯云IM状态回调", description = "腾讯云IM状态回调")
    public Object imCallback(HttpServletRequest request,
                             HttpServletResponse response) throws Exception {
        request.setCharacterEncoding("utf-8");
        BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(request.getInputStream(),"utf-8"));
        String content = Streams.read(bufferedReader).toString();
        JSONObject param =JSONUtil.parseObj(content);
        System.out.println("qqqqqqqqqqqqqq:"+content);
        JSONObject result = new JSONObject();
        result.put("ActionStatus", "OK");
        result.put("ErrorInfo", "");
        result.put("ErrorCode", "0");
        return result.toString();
    }

报错

[WARN ] 2020-07-23 16:52:45.803 com.ilanchuang.suoi.app.FailProcessor.process(FailProcessor.java:28) - Error@/serv/doctorAccount/imCallback :
java.lang.IllegalStateException: getReader() has already been called for this request
	at org.apache.catalina.connector.Request.getInputStream(Request.java:1114)
	at org.apache.catalina.connector.RequestFacade.getInputStream(RequestFacade.java:366)
	at javax.servlet.ServletRequestWrapper.getInputStream(ServletRequestWrapper.java:133)
	at com.ilanchuang.suoi.app.controller.syserver.inquiry.ServInquiryDoctorAccountController.imCallback(ServInquiryDoctorAccountController.java:67)

已经加了@Ok("void") 那里问题?

2 回复

找到问题了,加上@AdaptBy(type = VoidAdaptor.class)就行了

用Json适配器就好了把,不需要自行解码

添加回复
请先登陆
回到顶部