java 下载
来源:互联网 发布:淘宝管控记录怎么撤销 编辑:程序博客网 时间:2024/04/30 10:24
private static final String SQL_QUERY_MAP="select resname,contenttype,downtimes from courseresource where resid=?";
public Map getResourceInfo(int resid) ...{
Map i=jt.queryForMap(SQL_QUERY_MAP,new Object[]...{Integer.valueOf(resid)});
return i;
}
private static final String SQL_DOWNTIMES_UP="update courseresource set downtimes=? where resid=?";
public void addDownTimes(long downTimes, int resid) ...{
long downtime=downTimes+1;
jt.update(SQL_DOWNTIMES_UP,new Object[]...{downtime,resid});
}
private InputStream inputStream;
private String resFileContentType;
public InputStream getInputStream() ...{
return inputStream;
}
public void setInputStream(InputStream inputStream) ...{
this.inputStream = inputStream;
}
public String getResFileContentType() ...{
return resFileContentType;
}
public void setResFileContentType(String resFileContentType) ...{
this.resFileContentType = resFileContentType;
}
public String download() throws Exception ...{
long downTimes;
try ...{
Map res = getServMgr().getCourseResourceService().getResourceInfo(resid);
inputStream = new FileInputStream(ServletActionContext
.getServletContext().getRealPath(
"/WEB-INF/files/courseResource/" + resid + "."+(String) res.get("CONTENTTYPE")));
resFileFileName = URLEncoder.encode((String) res.get("RESNAME"),
"UTF-8");
log.debug("--------------------resFileFileName-----------------------"+resFileFileName);
resFileContentType = (String) res.get("CONTENTTYPE");
downTimes = Integer.parseInt(String.valueOf(res.get("DOWNTIMES")));
} catch (FileNotFoundException e) ...{
setResult(ERROR);
addMessage("下载的文件不存在!");
addRedirURL("关闭窗口", "javascript:window.close()");
return EXECUTE_RESULT;
}
getServMgr().getCourseResourceService().addDownTimes(downTimes, resid);
return SUCCESS;
}
public Map getResourceInfo(int resid) ...{
Map i=jt.queryForMap(SQL_QUERY_MAP,new Object[]...{Integer.valueOf(resid)});
return i;
}
private static final String SQL_DOWNTIMES_UP="update courseresource set downtimes=? where resid=?";
public void addDownTimes(long downTimes, int resid) ...{
long downtime=downTimes+1;
jt.update(SQL_DOWNTIMES_UP,new Object[]...{downtime,resid});
}
private InputStream inputStream;
private String resFileContentType;
public InputStream getInputStream() ...{
return inputStream;
}
public void setInputStream(InputStream inputStream) ...{
this.inputStream = inputStream;
}
public String getResFileContentType() ...{
return resFileContentType;
}
public void setResFileContentType(String resFileContentType) ...{
this.resFileContentType = resFileContentType;
}
public String download() throws Exception ...{
long downTimes;
try ...{
Map res = getServMgr().getCourseResourceService().getResourceInfo(resid);
inputStream = new FileInputStream(ServletActionContext
.getServletContext().getRealPath(
"/WEB-INF/files/courseResource/" + resid + "."+(String) res.get("CONTENTTYPE")));
resFileFileName = URLEncoder.encode((String) res.get("RESNAME"),
"UTF-8");
log.debug("--------------------resFileFileName-----------------------"+resFileFileName);
resFileContentType = (String) res.get("CONTENTTYPE");
downTimes = Integer.parseInt(String.valueOf(res.get("DOWNTIMES")));
} catch (FileNotFoundException e) ...{
setResult(ERROR);
addMessage("下载的文件不存在!");
addRedirURL("关闭窗口", "javascript:window.close()");
return EXECUTE_RESULT;
}
getServMgr().getCourseResourceService().addDownTimes(downTimes, resid);
return SUCCESS;
}
- java 下载
- java 下载
- java下载
- java 下载
- java 电子书下载
- 几个java下载网站
- ftp下载java源码
- Java有关下载提示
- Java相关工具下载
- Java编程电子书籍下载
- Java编程电子书籍下载
- java下载的servlet
- Java实现Http下载
- java 文档 工具 下载
- Java API中文版下载
- java下载的servlet
- java视频教程下载
- JAVA电子书下载
- 基于DS18B20的智能温度测量装置
- Vagrants流浪者全任务饰品
- vagrants流浪者全人物武器合成
- Web.config配置大文件上传
- 一个强大的小程序-Phun
- java 下载
- 探讨SQL Server 2005的安全策略
- 迈入2008IT猜想多多多
- 今天完成了linux下的apche mysql php安装
- SQL Server存储过程编写经验和优化
- SQL游标原理和使用方法
- 今天我在网上找到我教授授课的教科书了.Michael J. Folk, Bill Zoellick, Greg Riccardi, “File Structures: An Object-Oriented Approach with C++”, Addis
- C++程序设计本科教材推荐:适合初学者
- 输入一个整数,判断其是否为素数