forked from actframework/actframework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathC1.java
More file actions
executable file
·77 lines (66 loc) · 1.93 KB
/
C1.java
File metadata and controls
executable file
·77 lines (66 loc) · 1.93 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package playground;
import act.app.ActionContext;
import org.osgl.http.H;
import org.osgl.mvc.annotation.*;
import org.osgl.mvc.result.Result;
import org.osgl.util.S;
@With(C2.class)
public class C1 extends CBase {
@Before(except = "abc")
public void before1() {
}
@After(only = "xyz, 123")
public static void after1() {
}
// private static boolean cond1() {
// return _.random(true, false);
// }
//
@Action(value = "/", methods = {})
public void root(String id, String email, boolean b) {
String name = "root";
if (b) {
int i = 5;
render(id, email, name, b, i);
//System.out.println("abc");
} else {
if (S.empty(id)) {
int i = 0;
throw renderStatic("abc.html", id, i);
} else if (S.empty(email)) {
notFound("not found: %s", 404);
} else {
String reason = "abc";
int code = 5, code2 = 3, code4 = 2;
badRequest(reason, -1, code, code2, code4);
}
}
}
//
@GetAction(value = "/do_anno")
public void doAnno(@Param("svc_id") String svcId, int age, @Param("map") String map) {
ok();
}
//
// @GetAction("/foo")
// private static void bar(String id, String email, AppContext ctx) {
// if (cond1()) {
// renderStatic(id, email, ctx);
// }
// ok();
// }
@Action(value = "/doIt", methods = {H.Method.POST, H.Method.GET})
public static void doIt(@Param("acc_id") String id, ActionContext ctx, @Bind(EmailBinder.class) String email, boolean b) {
int i = 0, j = 1;
if (b) {
ok();
}
renderStatic("", i, j, b, id, email);
}
//
@Action(value = "/foo/bar", methods = {H.Method.POST, H.Method.PUT})
public static Result bar(String x) {
return ok();
}
private ActionContext ctx;
}