1414
1515import apijson .demo .server .common .StandardParser ;
1616import apijson .demo .server .common .UtilConstants ;
17+ import lombok .extern .slf4j .Slf4j ;
1718import org .springframework .web .bind .annotation .*;
1819
19- import zuo .biao .apijson .StringUtil ;
20+ import zuo .biao .apijson .*;
21+ import zuo .biao .apijson .RequestMethod ;
2022
2123/**
2224 * 通用Controller
2527 *
2628 * @author zhangls
2729 */
30+ @ Slf4j
2831@ RestController
2932public class Controller {
3033
34+
35+
3136 /**
3237 * 获取
3338 */
3439 @ PostMapping (UtilConstants .Request .GET )
3540 public String get (@ RequestBody String request , HttpSession session ) {
41+ log .info ("【进入 {} 方法,请求JSON串为】:{}" , RequestMethod .getName (GET ), request );
42+
3643 return new StandardParser (GET ).setSession (session ).parse (request );
3744 }
3845
@@ -41,6 +48,8 @@ public String get(@RequestBody String request, HttpSession session) {
4148 */
4249 @ PostMapping (UtilConstants .Request .HEAD )
4350 public String head (@ RequestBody String request , HttpSession session ) {
51+ log .info ("进入 {} 方法,请求JSON串为:{}" , RequestMethod .getName (HEAD ), request );
52+
4453 return new StandardParser (HEAD ).setSession (session ).parse (request );
4554 }
4655
@@ -49,6 +58,8 @@ public String head(@RequestBody String request, HttpSession session) {
4958 */
5059 @ PostMapping (UtilConstants .Request .GETS )
5160 public String gets (@ RequestBody String request , HttpSession session ) {
61+ log .info ("进入 {} 方法,请求JSON串为:{}" , RequestMethod .getName (GETS ), request );
62+
5263 return new StandardParser (GETS ).setSession (session ).parse (request );
5364 }
5465
@@ -57,6 +68,8 @@ public String gets(@RequestBody String request, HttpSession session) {
5768 */
5869 @ PostMapping (UtilConstants .Request .HEADS )
5970 public String heads (@ RequestBody String request , HttpSession session ) {
71+ log .info ("进入 {} 方法,请求JSON串为:{}" , RequestMethod .getName (HEADS ), request );
72+
6073 return new StandardParser (HEADS ).setSession (session ).parse (request );
6174 }
6275
@@ -65,6 +78,8 @@ public String heads(@RequestBody String request, HttpSession session) {
6578 */
6679 @ PostMapping (UtilConstants .Request .POST )
6780 public String post (@ RequestBody String request , HttpSession session ) {
81+ log .info ("进入 {} 方法,请求JSON串为:{}" , RequestMethod .getName (POST ), request );
82+
6883 return new StandardParser (POST ).setSession (session ).parse (request );
6984 }
7085
@@ -73,6 +88,8 @@ public String post(@RequestBody String request, HttpSession session) {
7388 */
7489 @ PostMapping (UtilConstants .Request .PUT )
7590 public String put (@ RequestBody String request , HttpSession session ) {
91+ log .info ("进入 {} 方法,请求JSON串为:{}" , RequestMethod .getName (PUT ), request );
92+
7693 return new StandardParser (PUT ).setSession (session ).parse (request );
7794 }
7895
@@ -81,6 +98,8 @@ public String put(@RequestBody String request, HttpSession session) {
8198 */
8299 @ PostMapping (UtilConstants .Request .DELETE )
83100 public String delete (@ RequestBody String request , HttpSession session ) {
101+ log .info ("进入 {} 方法,请求JSON串为:{}" , RequestMethod .getName (DELETE ), request );
102+
84103 return new StandardParser (DELETE ).setSession (session ).parse (request );
85104 }
86105
0 commit comments