40
40
import javax .validation .ConstraintViolationException ;
41
41
import javax .validation .Validator ;
42
42
import javax .validation .groups .Default ;
43
- import javax .ws .rs .core .Context ;
44
43
import java .util .Calendar ;
45
44
import java .util .List ;
46
45
import java .util .Map ;
@@ -66,7 +65,7 @@ public class ApiServiceCoreRestfulApi {
66
65
private static final Pattern WRITABLE_PATTERN = Pattern .compile ("^\\ s*(insert|update|delete|drop|alter|create).*" , Pattern .CASE_INSENSITIVE | Pattern .DOTALL );
67
66
68
67
@ RequestMapping (value = "/api" ,method = RequestMethod .POST )
69
- public Message insert (ApiServiceVo apiService , @ Context HttpServletRequest req ) {
68
+ public Message insert (@ RequestBody ApiServiceVo apiService , HttpServletRequest req ) {
70
69
return ApiUtils .doAndResponse (() -> {
71
70
72
71
if (apiService .getWorkspaceId () == null ){
@@ -139,7 +138,7 @@ public Message insert(ApiServiceVo apiService, @Context HttpServletRequest req)
139
138
}
140
139
141
140
@ RequestMapping (value = "/create" ,method = RequestMethod .POST )
142
- public Message create (ApiServiceVo apiService , @ Context HttpServletRequest req ) {
141
+ public Message create (@ RequestBody ApiServiceVo apiService , HttpServletRequest req ) {
143
142
return ApiUtils .doAndResponse (() -> {
144
143
145
144
if (apiService .getWorkspaceId () == null ){
@@ -212,9 +211,9 @@ public Message create(ApiServiceVo apiService, @Context HttpServletRequest req)
212
211
}
213
212
214
213
@ RequestMapping (value = "/api/{api_service_version_id}" ,method = RequestMethod .PUT )
215
- public Message update (ApiServiceVo apiService ,
214
+ public Message update (@ RequestBody ApiServiceVo apiService ,
216
215
@ PathVariable ("api_service_version_id" ) Long apiServiceVersionId ,
217
- @ Context HttpServletRequest req ) {
216
+ HttpServletRequest req ) {
218
217
return ApiUtils .doAndResponse (() -> {
219
218
220
219
if (StringUtils .isBlank (apiService .getScriptPath ())) {
@@ -299,7 +298,7 @@ public Message query(@RequestParam(required = false, name = "name") String name,
299
298
@ RequestParam (required = false , name = "status" ) Integer status ,
300
299
@ RequestParam (required = false , name = "creator" ) String creator ,
301
300
@ RequestParam (required = false , name = "workspaceId" ) Integer workspaceId ,
302
- @ Context HttpServletRequest req ) {
301
+ HttpServletRequest req ) {
303
302
String userName = SecurityFilter .getLoginUsername (req );
304
303
305
304
return ApiUtils .doAndResponse (() -> {
@@ -319,7 +318,7 @@ public Message query(@RequestParam(required = false, name = "name") String name,
319
318
320
319
@ RequestMapping (value = "/getUserServices" ,method = RequestMethod .GET )
321
320
public Message getUserServices (@ RequestParam (required = false , name = "workspaceId" ) Integer workspaceId ,
322
- @ Context HttpServletRequest req ){
321
+ HttpServletRequest req ){
323
322
String userName = SecurityFilter .getLoginUsername (req );
324
323
return ApiUtils .doAndResponse (() -> {
325
324
if (!this .apiService .checkUserWorkspace (userName ,workspaceId ) ){
@@ -333,7 +332,7 @@ public Message getUserServices(@RequestParam(required = false, name = "workspace
333
332
334
333
335
334
@ RequestMapping (value = "/tags" ,method = RequestMethod .GET )
336
- public Message query ( @ Context HttpServletRequest req ,@ RequestParam (required = false , name = "workspaceId" ) Integer workspaceId ) {
335
+ public Message query ( HttpServletRequest req ,@ RequestParam (required = false , name = "workspaceId" ) Integer workspaceId ) {
337
336
String userName = SecurityFilter .getLoginUsername (req );
338
337
return ApiUtils .doAndResponse (() -> {
339
338
@@ -347,7 +346,7 @@ public Message query( @Context HttpServletRequest req,@RequestParam(required = f
347
346
348
347
@ RequestMapping (value = "/query" ,method = RequestMethod .GET )
349
348
public Message queryByScriptPath (@ RequestParam (required = false , name = "scriptPath" ) String scriptPath ,
350
- @ Context HttpServletRequest req ) {
349
+ HttpServletRequest req ) {
351
350
return ApiUtils .doAndResponse (() -> {
352
351
String userName = SecurityFilter .getLoginUsername (req );
353
352
if (StringUtils .isBlank (scriptPath )) {
@@ -372,7 +371,7 @@ public Message queryByScriptPath(@RequestParam(required = false, name = "scriptP
372
371
373
372
@ RequestMapping (value = "/queryById" ,method = RequestMethod .GET )
374
373
public Message queryById (@ RequestParam (required = false , name = "id" ) Long id ,
375
- @ Context HttpServletRequest req ) {
374
+ HttpServletRequest req ) {
376
375
String userName = SecurityFilter .getLoginUsername (req );
377
376
return ApiUtils .doAndResponse (() -> {
378
377
if (id ==null ) {
@@ -416,7 +415,7 @@ public Message checkName(@RequestParam(required = false, name = "name") String n
416
415
417
416
@ RequestMapping (value = "/apiDisable" ,method = RequestMethod .GET )
418
417
public Message apiDisable (@ RequestParam (required = false , name = "id" ) Long id ,
419
- @ Context HttpServletRequest req ) {
418
+ HttpServletRequest req ) {
420
419
return ApiUtils .doAndResponse (() -> {
421
420
String userName = SecurityFilter .getLoginUsername (req );
422
421
if (null == id ) {
@@ -429,7 +428,7 @@ public Message apiDisable(@RequestParam(required = false, name = "id") Long id,
429
428
430
429
@ RequestMapping (value = "/apiEnable" ,method = RequestMethod .GET )
431
430
public Message apiEnable (@ RequestParam (required = false , name = "id" ) Long id ,
432
- @ Context HttpServletRequest req ) {
431
+ HttpServletRequest req ) {
433
432
return ApiUtils .doAndResponse (() -> {
434
433
String userName = SecurityFilter .getLoginUsername (req );
435
434
if (null == id ) {
@@ -442,7 +441,7 @@ public Message apiEnable(@RequestParam(required = false, name = "id") Long id,
442
441
443
442
@ RequestMapping (value = "/apiDelete" ,method = RequestMethod .GET )
444
443
public Message apiDelete (@ RequestParam (required = false , name = "id" ) Long id ,
445
- @ Context HttpServletRequest req ) {
444
+ HttpServletRequest req ) {
446
445
//目前暂时不实际删除数据,只做不可见和不可用。
447
446
return ApiUtils .doAndResponse (() -> {
448
447
String userName = SecurityFilter .getLoginUsername (req );
@@ -455,7 +454,7 @@ public Message apiDelete(@RequestParam(required = false, name = "id") Long id,
455
454
}
456
455
457
456
@ RequestMapping (value = "/apiCommentUpdate" ,method = RequestMethod .POST )
458
- public Message apiCommentUpdate (@ Context HttpServletRequest req ,
457
+ public Message apiCommentUpdate (HttpServletRequest req ,
459
458
@ RequestBody ApiCommentUpdateRequest apiCommentUpdateRequest ) {
460
459
Long id = apiCommentUpdateRequest .getId ();
461
460
String comment = apiCommentUpdateRequest .getComment ();
@@ -474,7 +473,7 @@ public Message apiCommentUpdate(@Context HttpServletRequest req,
474
473
@ RequestMapping (value = "/apiParamQuery" ,method = RequestMethod .GET )
475
474
public Message apiParamQuery (@ RequestParam (required = false , name = "scriptPath" ) String scriptPath ,
476
475
@ RequestParam (required = false , name = "versionId" ) Long versionId ,
477
- @ Context HttpServletRequest req ) {
476
+ HttpServletRequest req ) {
478
477
return ApiUtils .doAndResponse (() -> {
479
478
String userName = SecurityFilter .getLoginUsername (req );
480
479
if (StringUtils .isEmpty (scriptPath )) {
@@ -490,7 +489,7 @@ public Message apiParamQuery(@RequestParam(required = false, name = "scriptPath"
490
489
491
490
@ RequestMapping (value = "/apiVersionQuery" ,method = RequestMethod .GET )
492
491
public Message apiVersionQuery (@ RequestParam (required = false , name = "serviceId" ) Long serviceId ,
493
- @ Context HttpServletRequest req ) {
492
+ HttpServletRequest req ) {
494
493
return ApiUtils .doAndResponse (() -> {
495
494
String userName = SecurityFilter .getLoginUsername (req );
496
495
if (null == serviceId ) {
@@ -505,7 +504,7 @@ public Message apiVersionQuery(@RequestParam(required = false, name = "serviceId
505
504
506
505
@ RequestMapping (value = "/apiContentQuery" ,method = RequestMethod .GET )
507
506
public Message apiContentQuery (@ RequestParam (required = false , name = "versionId" ) Long versionId ,
508
- @ Context HttpServletRequest req ) {
507
+ HttpServletRequest req ) {
509
508
String userName = SecurityFilter .getLoginUsername (req );
510
509
return ApiUtils .doAndResponse (() -> {
511
510
if (null == versionId ) {
0 commit comments