Skip to content

Commit 7b7500a

Browse files
committed
Server:简化Controller中的Request注解;Application新增测试Log
1 parent 2c1596b commit 7b7500a

File tree

2 files changed

+23
-15
lines changed

2 files changed

+23
-15
lines changed

APIJSON-Java-Server/APIJSON-Eclipse/src/main/java/apijson/demo/server/APIJSONApplication.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,26 @@ public class APIJSONApplication {
3232
public static void main(String[] args) throws Exception {
3333
SpringApplication.run(APIJSONApplication.class, args);
3434

35+
System.out.println("\n\n\n\n\n<<<<<<<<<<<<<<<<<<<<<<<<< APIJSON >>>>>>>>>>>>>>>>>>>>>>>>\n");
36+
System.out.println("开始测试:远程函数 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
3537
try {
3638
Function.test();
3739
} catch (Exception e) {
3840
e.printStackTrace();
3941
}
42+
System.out.println("\n完成测试:远程函数 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
4043

4144
// Structure.init();
4245

46+
System.out.println("\n\n\n开始测试:请求校验 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
4347
try {
4448
Structure.test();
4549
} catch (Exception e) {
4650
e.printStackTrace();
4751
}
52+
System.out.println("\n完成测试:请求校验 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
53+
54+
System.out.println("\n\n<<<<<<<<<<<<<<<<<<<<<<<<< APIJSON已启动 >>>>>>>>>>>>>>>>>>>>>>>>\n");
4855
}
4956

5057

APIJSON-Java-Server/APIJSON-Eclipse/src/main/java/apijson/demo/server/Controller.java

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import javax.servlet.http.HttpSession;
3030

3131
import org.springframework.web.bind.annotation.PathVariable;
32+
import org.springframework.web.bind.annotation.PostMapping;
3233
import org.springframework.web.bind.annotation.RequestBody;
3334
import org.springframework.web.bind.annotation.RequestMapping;
3435
import org.springframework.web.bind.annotation.RestController;
@@ -74,7 +75,7 @@ public class Controller {
7475
* @return
7576
* @see {@link RequestMethod#GET}
7677
*/
77-
@RequestMapping(value = "get", method = org.springframework.web.bind.annotation.RequestMethod.POST)
78+
@PostMapping(value = "get")
7879
public String get(@RequestBody String request, HttpSession session) {
7980
return new Parser(GET).setSession(session).parse(request);
8081
}
@@ -85,7 +86,7 @@ public String get(@RequestBody String request, HttpSession session) {
8586
* @return
8687
* @see {@link RequestMethod#HEAD}
8788
*/
88-
@RequestMapping(value = "head", method = org.springframework.web.bind.annotation.RequestMethod.POST)
89+
@PostMapping("head")
8990
public String head(@RequestBody String request, HttpSession session) {
9091
return new Parser(HEAD).setSession(session).parse(request);
9192
}
@@ -96,7 +97,7 @@ public String head(@RequestBody String request, HttpSession session) {
9697
* @return
9798
* @see {@link RequestMethod#GETS}
9899
*/
99-
@RequestMapping(value = "gets", method = org.springframework.web.bind.annotation.RequestMethod.POST)
100+
@PostMapping("gets")
100101
public String gets(@RequestBody String request, HttpSession session) {
101102
return new Parser(GETS).setSession(session).parse(request);
102103
}
@@ -107,7 +108,7 @@ public String gets(@RequestBody String request, HttpSession session) {
107108
* @return
108109
* @see {@link RequestMethod#HEADS}
109110
*/
110-
@RequestMapping(value = "heads", method = org.springframework.web.bind.annotation.RequestMethod.POST)
111+
@PostMapping("heads")
111112
public String heads(@RequestBody String request, HttpSession session) {
112113
return new Parser(HEADS).setSession(session).parse(request);
113114
}
@@ -118,7 +119,7 @@ public String heads(@RequestBody String request, HttpSession session) {
118119
* @return
119120
* @see {@link RequestMethod#POST}
120121
*/
121-
@RequestMapping(value = "post", method = org.springframework.web.bind.annotation.RequestMethod.POST)
122+
@PostMapping("post")
122123
public String post(@RequestBody String request, HttpSession session) {
123124
return new Parser(POST).setSession(session).parse(request);
124125
}
@@ -129,7 +130,7 @@ public String post(@RequestBody String request, HttpSession session) {
129130
* @return
130131
* @see {@link RequestMethod#PUT}
131132
*/
132-
@RequestMapping(value = "put", method = org.springframework.web.bind.annotation.RequestMethod.POST)
133+
@PostMapping("put")
133134
public String put(@RequestBody String request, HttpSession session) {
134135
return new Parser(PUT).setSession(session).parse(request);
135136
}
@@ -140,7 +141,7 @@ public String put(@RequestBody String request, HttpSession session) {
140141
* @return
141142
* @see {@link RequestMethod#DELETE}
142143
*/
143-
@RequestMapping(value = "delete", method = org.springframework.web.bind.annotation.RequestMethod.POST)
144+
@PostMapping("delete")
144145
public String delete(@RequestBody String request, HttpSession session) {
145146
return new Parser(DELETE).setSession(session).parse(request);
146147
}
@@ -267,7 +268,7 @@ public String open_head(@PathVariable String request, HttpSession session) {
267268
* @param request
268269
* @return
269270
*/
270-
@RequestMapping(value = "post/verify", method = org.springframework.web.bind.annotation.RequestMethod.POST)
271+
@PostMapping("post/verify")
271272
public JSONObject postVerify(@RequestBody String request) {
272273
JSONObject requestObject = null;
273274
int type;
@@ -307,7 +308,7 @@ public JSONObject postVerify(@RequestBody String request) {
307308
* @param request
308309
* @return
309310
*/
310-
@RequestMapping(value = "gets/verify", method = org.springframework.web.bind.annotation.RequestMethod.POST)
311+
@PostMapping("gets/verify")
311312
public JSONObject getVerify(@RequestBody String request) {
312313
JSONObject requestObject = null;
313314
int type;
@@ -326,7 +327,7 @@ public JSONObject getVerify(@RequestBody String request) {
326327
* @param request
327328
* @return
328329
*/
329-
@RequestMapping(value = "heads/verify", method = org.springframework.web.bind.annotation.RequestMethod.POST)
330+
@PostMapping("heads/verify")
330331
public JSONObject headVerify(@RequestBody String request) {
331332
JSONObject requestObject = null;
332333
int type;
@@ -409,7 +410,7 @@ private JSONObject newVerifyRequest(int type, String phone, String verify) {
409410
}
410411
* </pre>
411412
*/
412-
@RequestMapping(value = "login", method = org.springframework.web.bind.annotation.RequestMethod.POST)
413+
@PostMapping("login")
413414
public JSONObject login(@RequestBody String request, HttpSession session) {
414415
JSONObject requestObject = null;
415416
boolean isPassword;
@@ -517,7 +518,7 @@ public JSONObject login(@RequestBody String request, HttpSession session) {
517518
* @param session
518519
* @return
519520
*/
520-
@RequestMapping(value = "logout", method = org.springframework.web.bind.annotation.RequestMethod.POST)
521+
@PostMapping("logout")
521522
public JSONObject logout(HttpSession session) {
522523
long userId;
523524
try {
@@ -556,7 +557,7 @@ public JSONObject logout(HttpSession session) {
556557
}
557558
* </pre>
558559
*/
559-
@RequestMapping(value = REGISTER, method = org.springframework.web.bind.annotation.RequestMethod.POST)
560+
@PostMapping(REGISTER)
560561
public JSONObject register(@RequestBody String request) {
561562
JSONObject requestObject = null;
562563

@@ -672,7 +673,7 @@ public static JSONObject newIllegalArgumentResult(JSONObject requestObject, Stri
672673
}
673674
* </pre>
674675
*/
675-
@RequestMapping(value = "put/password", method = org.springframework.web.bind.annotation.RequestMethod.POST)
676+
@PostMapping("put/password")
676677
public JSONObject putPassword(@RequestBody String request){
677678
JSONObject requestObject = null;
678679
String old_password;
@@ -789,7 +790,7 @@ else if (StringUtil.isPhone(phone) && StringUtil.isVerify(verify)) {
789790
}
790791
* </pre>
791792
*/
792-
@RequestMapping(value = "put/balance", method = org.springframework.web.bind.annotation.RequestMethod.POST)
793+
@PostMapping("put/balance")
793794
public JSONObject putBalance(@RequestBody String request, HttpSession session) {
794795
JSONObject requestObject = null;
795796
JSONObject privacyObj;

0 commit comments

Comments
 (0)