mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 12:56:28 +08:00
新增restful模式
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package com.sop.example.rest.examplerest.rest.impl;
|
||||
|
||||
import com.gitee.sop.support.context.OpenContext;
|
||||
import com.gitee.sop.support.context.WebContext;
|
||||
import com.sop.example.rest.examplerest.rest.GoodsController;
|
||||
import com.sop.example.rest.examplerest.rest.vo.GoodsVO;
|
||||
@@ -24,20 +23,18 @@ public class GoodsControllerImpl implements GoodsController {
|
||||
goodsVO.setName("冰箱");
|
||||
|
||||
List<String> list = new ArrayList<>();
|
||||
|
||||
// 获取真实地址
|
||||
list.add("realIp:" + webContext.getRealIp());
|
||||
|
||||
// 获取请求头
|
||||
Map<String, String> headers = webContext.getHeaders();
|
||||
String token = headers.get("token");
|
||||
list.add("token:" + token);
|
||||
|
||||
String remoteAddr = webContext.getRemoteAddr();
|
||||
list.add("remoteAddr:" + remoteAddr);
|
||||
|
||||
// 获取请求参数
|
||||
String idValue = webContext.getParameter("id");
|
||||
list.add("id:" + idValue);
|
||||
|
||||
goodsVO.setRemark(list.toString());
|
||||
|
||||
System.out.println(list);
|
||||
return goodsVO;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user