资源简介
下载服务器文件到本地,并删除已下载的服务器文件
代码片段和文件信息
package com.fron.timer.down.servlet;
import java.io.IOException;
import java.util.Timer;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class DownCleanHttpServlet extends HttpServlet {
/**
*
*/
private static final long serialVersionUID = 1L;
private Timer timer;
/**
* Constructor of the object.
*/
public DownCleanHttpServlet() {
super();
}
/**
* Destruction of the servlet.
*/
public void destroy() {
super.destroy(); // Just puts “destroy“ string in log
// Put your code here
}
/**
* The doGet method of the servlet.
*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request HttpServletResponse response)
throws ServletException IOException {
doPost(request response);
}
/**
* The doPost method of the servlet.
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doPost(HttpServletRequest request HttpServletResponse response)
throws ServletException IOException {
String flag = request.getParameter(“flag“);
if(flag.equals(“true“)){//启动定时任务
timer.schedule(new DownCleanTask() 1000*10 1000*60*3);//在5秒后执行此任务每次间隔3分钟执行一次
}else if(flag.equals(“false“)){//暂时定时任务
timer.cancel();//使用这个方法退出任务
}
}
/**
* Initialization of the servlet.
*
* @throws ServletException if an error occurs
*/
public void init() throws ServletException {
timer = new Timer();
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1338 2017-03-30 11:18 TimerCleanLog\.project
文件 414 2017-03-30 09:14 TimerCleanLog\.settings\org.eclipse.wst.common.project.facet.core.xm
文件 364 2017-03-30 09:14 TimerCleanLog\.settings\org.eclipse.jdt.core.prefs
文件 498 2017-03-30 09:14 TimerCleanLog\.settings\org.eclipse.wst.common.component
文件 522 2017-03-30 09:14 TimerCleanLog\.settings\.jsdtscope
文件 6 2017-03-30 09:14 TimerCleanLog\.settings\org.eclipse.wst.jsdt.ui.superType.name
文件 49 2017-03-30 09:14 TimerCleanLog\.settings\org.eclipse.wst.jsdt.ui.superType.container
文件 66 2017-03-30 09:38 TimerCleanLog\.settings\org.eclipse.core.resources.prefs
文件 1146 2017-03-30 11:45 TimerCleanLog\src\com\fron\timer\down\servlet\DownCleanTask.java
文件 2254 2017-03-30 11:33 TimerCleanLog\src\com\fron\timer\down\servlet\DownCleanHttpServlet.java
文件 10811 2017-03-30 13:56 TimerCleanLog\src\com\fron\timer\util\SftpUtil.java
文件 1632 2017-03-30 11:33 TimerCleanLog\WebRoot\WEB-INF\classes\com\fron\timer\down\servlet\DownCleanHttpServlet.class
文件 1722 2017-03-30 11:45 TimerCleanLog\WebRoot\WEB-INF\classes\com\fron\timer\down\servlet\DownCleanTask.class
文件 8198 2017-03-30 13:56 TimerCleanLog\WebRoot\WEB-INF\classes\com\fron\timer\util\SftpUtil.class
文件 278612 2017-03-29 17:16 TimerCleanLog\WebRoot\WEB-INF\lib\jsch-0.1.54.jar
文件 632 2017-03-30 09:44 TimerCleanLog\WebRoot\WEB-INF\web.xm
文件 1224 2017-03-30 14:24 TimerCleanLog\WebRoot\index.jsp
文件 39 2017-03-30 09:14 TimerCleanLog\WebRoot\me
文件 95957 2017-01-04 14:38 TimerCleanLog\WebRoot\js\jquery-1.11.3.min.js
文件 1094 2017-03-30 09:14 TimerCleanLog\.classpath
目录 0 2017-03-30 09:24 TimerCleanLog\WebRoot\WEB-INF\classes\com\fron\timer\down\servlet
目录 0 2017-03-30 09:24 TimerCleanLog\WebRoot\WEB-INF\classes\com\fron\timer\down
目录 0 2017-03-30 09:26 TimerCleanLog\WebRoot\WEB-INF\classes\com\fron\timer\util
目录 0 2017-03-30 09:15 TimerCleanLog\src\com\fron\timer\down\servlet
目录 0 2017-03-30 09:15 TimerCleanLog\WebRoot\WEB-INF\classes\com\fron\timer
目录 0 2017-03-30 09:24 TimerCleanLog\src\com\fron\timer\down
目录 0 2017-03-30 09:26 TimerCleanLog\src\com\fron\timer\util
目录 0 2017-03-30 09:15 TimerCleanLog\WebRoot\WEB-INF\classes\com\fron
目录 0 2017-03-30 09:15 TimerCleanLog\src\com\fron\timer
目录 0 2017-03-30 09:15 TimerCleanLog\WebRoot\WEB-INF\classes\com
............此处省略14个文件信息
- 上一篇:vue.js 仿百度搜索
- 下一篇:FX2N-1PG程序
评论
共有 条评论