新增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;
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;
}
}