mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 12:56:28 +08:00
新增restful模式
This commit is contained in:
@@ -6,6 +6,8 @@ import com.sop.example.rest.examplerest.rest.GoodsController;
|
||||
import com.sop.example.rest.examplerest.rest.vo.GoodsVO;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -16,13 +18,26 @@ import java.util.Map;
|
||||
public class GoodsControllerImpl implements GoodsController {
|
||||
@Override
|
||||
public GoodsVO getById(Integer id) {
|
||||
WebContext webContext = WebContext.current();
|
||||
GoodsVO goodsVO = new GoodsVO();
|
||||
goodsVO.setId(id);
|
||||
goodsVO.setName("冰箱");
|
||||
|
||||
Map<String, String> headers = WebContext.current().getHeaders();
|
||||
List<String> list = new ArrayList<>();
|
||||
|
||||
list.add("realIp:" + webContext.getRealIp());
|
||||
|
||||
Map<String, String> headers = webContext.getHeaders();
|
||||
String token = headers.get("token");
|
||||
System.out.println(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());
|
||||
return goodsVO;
|
||||
}
|
||||
}
|
||||
|
@@ -12,4 +12,6 @@ public class GoodsVO {
|
||||
|
||||
private String name;
|
||||
|
||||
private String remark;
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user