1 |
package dk.thoerup.droidradarservice; |
2 |
|
3 |
import java.io.IOException; |
4 |
import java.sql.Connection; |
5 |
import java.sql.ResultSet; |
6 |
import java.sql.SQLException; |
7 |
import java.sql.Statement; |
8 |
import java.util.ArrayList; |
9 |
import java.util.List; |
10 |
|
11 |
import javax.servlet.ServletException; |
12 |
import javax.servlet.http.HttpServlet; |
13 |
import javax.servlet.http.HttpServletRequest; |
14 |
import javax.servlet.http.HttpServletResponse; |
15 |
|
16 |
/** |
17 |
* Servlet implementation class ResetLastUpdate |
18 |
*/ |
19 |
public class ResetLastUpdate extends HttpServlet { |
20 |
private static final long serialVersionUID = 1L; |
21 |
|
22 |
/** |
23 |
* @see HttpServlet#HttpServlet() |
24 |
*/ |
25 |
public ResetLastUpdate() { |
26 |
super(); |
27 |
// TODO Auto-generated constructor stub |
28 |
} |
29 |
|
30 |
/** |
31 |
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) |
32 |
*/ |
33 |
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { |
34 |
Connection conn = null; |
35 |
try |
36 |
{ |
37 |
conn = DBConnection.getConnection(); |
38 |
|
39 |
Statement stmt = conn.createStatement(); |
40 |
stmt.execute("UPDATE droidradar SET updated=now()"); |
41 |
|
42 |
|
43 |
} catch (Exception e) { |
44 |
throw new ServletException(e); |
45 |
|
46 |
} finally { |
47 |
try{ |
48 |
if (conn != null && !conn.isClosed() ) |
49 |
conn.close(); |
50 |
} catch (SQLException e) {} |
51 |
} |
52 |
|
53 |
response.sendRedirect("/DroidRadarService/ViewDroidLocations"); |
54 |
} |
55 |
} |