forked from m0ver/tinystruct-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstartup.java
More file actions
56 lines (42 loc) · 1013 Bytes
/
startup.java
File metadata and controls
56 lines (42 loc) · 1013 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package tinystruct.examples;
import java.io.IOException;
import java.util.Date;
import javax.servlet.http.HttpServletResponse;
import org.tinystruct.AbstractApplication;
public class startup extends AbstractApplication {
private static boolean stop;
@Override
public void init() {
// TODO Auto-generated method stub
this.setAction("startup", "index");
}
public startup index() {
return this;
}
public void start() {
stop=false;
}
public void update() throws IOException, InterruptedException {
HttpServletResponse response = (HttpServletResponse) this.context
.getAttribute("HTTP_RESPONSE");
while(true)
if (!stop) {
response.getWriter().println(
"<script> parent.update('" + new Date()
+ "');</script>");
response.getWriter().flush();
Thread.sleep(1000);
}else {
break;
}
}
public String stop() {
stop = true;
return "stopped!";
}
@Override
public String version() {
// TODO Auto-generated method stub
return null;
}
}