Spring security 4.0.1中SavedRequestAwareWrapper.getRequest()的等价物是什么?

时间:2015-06-23 11:57:42

标签: java spring spring-security

我是Spring的新手,我被要求输入为spring security 2.0.4编写的代码。使用4.0.1,我收到以下代码的编译错误:

private void printArgs(Object[] args) {
  for (int i=0; i < args.length; i++) {
     Object o = args[i];
     if (o instanceof SavedRequestAwareWrapper) {
        SavedRequestAwareWrapper w = (SavedRequestAwareWrapper) o;
        logger.info("HTTP METHOD: " + w.getMethod());
        try {
            BufferedRequestWrapper brw = new BufferedRequestWrapper((HttpServletRequest) w.getRequest());
            InputStream is = brw.getInputStream();
            byte[] b = new byte[is.available()];
            is.read(b);
            String s = new String(b);
            logger.info("post body:\n" + s);
            } catch (IOException e) {
               e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
            }
    } else {
        logger.info(o.toString());
    }
  }
}

据我所知,SavedRequestAwareWrapper在4.0.1中已弃用。有人可以告诉我相同的等价物吗?

0 个答案:

没有答案