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