您的位置:首页 > 运维架构

犯了一个愚蠢的错误

2014-12-19 01:06 483 查看
/**
*@authorkc
*
*/
publicclassUrlAccessFilterimplementsFilter{

privateInputStreampath;

publicvoidinit(FilterConfigfilterConfig)throwsServletException{
}

publicvoiddoFilter(ServletRequestrequest,ServletResponseresponse,
FilterChainfilterChain)throwsIOException,ServletException{
System.out.println("正在访问hichujianapk");
path=null;
System.out.println(path);
path=this.getClass().getClassLoader()
.getResourceAsStream("download_count.properties");
Propertiesprop=newProperties();
FileOutputStreamfos=null;
try{

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

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

publicvoiddestroy(){
}

}

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  properties