enterpriseqiandaonotice/src/com/ideabobo/util/DownloadAction.java
(完整代码) 953Bpackage com.ideabobo.util;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import org.apache.struts2.ServletActionContext;
public class DownloadAction extends IdeaAction {
private String fileName;
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getDownloadFileName(){
return "123123.mp4";
}
public InputStream getInputStream() {
String path = ServletActionContext.getServletContext().getRealPath("/upload/"+fileName);
File file = new File(path);
if(file.exists()){
try {
return new FileInputStream(file);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
}else {
return null;
}
}
public String execute() {
return "success";
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。