如何在春季记录来自客户端的请求

时间:2014-04-23 11:45:22

标签: spring-mvc servlets

我想记录从客户端发布的json数据。我也写了拦截器。我收到请求,但我无法记录reuqest的json部分。我该怎么做? 这是我的postdata json:

{"callerId":3456,"sessionId":"1554ba7c-b729-4dc5-9dd2-c48e2b275c3f","uniqueId":"some","courseProgress":{"bookmark":{"contentId":"aec4b2c5-6766-4d51-80ac-8fdc61f465ed","version":1}}}

这是我的loggerInterceptor代码:

 public class LoggerInterceptor extends HandlerInterceptorAdapter {
    static Logger logger = Logger.getLogger(LoggerInterceptor.class);

    static {
        BasicConfigurator.configure();
    }

    @Override

public boolean preHandle(HttpServletRequest request,
                         HttpServletResponse response, Object handler) throws Exception {

    logger.info("Before handling the request");

    return super.preHandle(request, response, handler);
}
}

所以我收到请求但无法检索json数据

0 个答案:

没有答案