org.apache.log4j.lf5.util.StreamUtils源码实例Demo

类org.apache.log4j.lf5.util.StreamUtils源码实例Demo

下面列出了org.apache.log4j.lf5.util.StreamUtils 类实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

protected void doPost(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException
{
  log.debug("Start doPost");
  try {
    // Inputstream
    final InputStream is = request.getInputStream();
    final byte[] buffer = StreamUtils.getBytes(is);
    String filename;
    String croppedname;
    if (request.getParameter("croppedname") != null) {
      croppedname = request.getParameter("croppedname");
    } else {
      croppedname = "cropped";
    }
    if ((request.getParameter("filename") != null) && (request.getParameter("filetype") != null)) {
      filename = croppedname + request.getParameter("filename") + "." + request.getParameter("filetype");
    } else {
      filename = "image.png";
    }
    log.info("Filename: " + filename);
    ResponseUtils.streamToOut(filename, buffer, response, request.getSession().getServletContext(), true);
  } catch (Exception ex) {
    log.warn("Failure reading the request");
    log.warn(ex.getMessage(), ex);
  }
}
 
源代码评论
动弹
沙发等你来抢
 类所在包
 同包方法