码迷,mamicode.com
首页 > 其他好文 > 详细

犯了一个愚蠢的错误

时间:2014-12-19 02:04:13      阅读:142      评论:0      收藏:0      [点我收藏+]

标签:des   http   ar   io   os   sp   java   on   art   

/**
 * @author kc
 *
 */
public class UrlAccessFilter implements Filter {

 private InputStream path;

 public void init(FilterConfig filterConfig) throws ServletException {
 }

 public void doFilter(ServletRequest request, ServletResponse response,
   FilterChain filterChain) throws IOException, ServletException {
  System.out.println("正在访问hichujian apk");
  path = null;
  System.out.println(path);
  path = this.getClass().getClassLoader()
    .getResourceAsStream("download_count.properties");
  Properties prop = new Properties();
  FileOutputStream fos = null;
  try {

   prop.load(path);
   String download_number = prop.getProperty("number");
   System.out.println(download_number);
   path.close();
   fos = new FileOutputStream(new File(this.getClass()
     .getResource("/").getPath()
     + "download_count.properties"));
   int download = Integer.parseInt(download_number);
   download++;
   prop.setProperty("number", String.valueOf(download));
   prop.store(fos, null);
    fos.close();
   /* filterChain.doFilter(request, response); */

  } catch (Exception e) {
   e.printStackTrace();
  }
 }

 public void destroy() {
 }

}

 

犯了一个愚蠢的错误

标签:des   http   ar   io   os   sp   java   on   art   

原文地址:http://my.oschina.net/11101010/blog/357894

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!