新增restful模式

This commit is contained in:
六如
2025-02-04 12:16:58 +08:00
parent f9a663d560
commit 1fa806fcd5

View File

@@ -1,6 +1,5 @@
package com.sop.example.rest.examplerest.rest.impl; package com.sop.example.rest.examplerest.rest.impl;
import com.gitee.sop.support.context.OpenContext;
import com.gitee.sop.support.context.WebContext; import com.gitee.sop.support.context.WebContext;
import com.sop.example.rest.examplerest.rest.GoodsController; import com.sop.example.rest.examplerest.rest.GoodsController;
import com.sop.example.rest.examplerest.rest.vo.GoodsVO; import com.sop.example.rest.examplerest.rest.vo.GoodsVO;
@@ -24,20 +23,18 @@ public class GoodsControllerImpl implements GoodsController {
goodsVO.setName("冰箱"); goodsVO.setName("冰箱");
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
// 获取真实地址
list.add("realIp:" + webContext.getRealIp()); list.add("realIp:" + webContext.getRealIp());
// 获取请求头
Map<String, String> headers = webContext.getHeaders(); Map<String, String> headers = webContext.getHeaders();
String token = headers.get("token"); String token = headers.get("token");
list.add("token:" + token); list.add("token:" + token);
// 获取请求参数
String remoteAddr = webContext.getRemoteAddr();
list.add("remoteAddr:" + remoteAddr);
String idValue = webContext.getParameter("id"); String idValue = webContext.getParameter("id");
list.add("id:" + idValue); list.add("id:" + idValue);
goodsVO.setRemark(list.toString()); goodsVO.setRemark(list.toString());
System.out.println(list);
return goodsVO; return goodsVO;
} }
} }