新增/public/request.do接口获取请求参数信息,用于测试回调
This commit is contained in:
parent
f53bc2d48d
commit
e7c269e6ba
@ -9,7 +9,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class ToolsApplication {
|
public class ToolsApplication {
|
||||||
public static final String version="1.0.14";
|
public static final String version="1.0.14.1";
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.out.println("当前版本号:"+version);
|
System.out.println("当前版本号:"+version);
|
||||||
|
@ -3,6 +3,8 @@ package com.yutou.tools.other;
|
|||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.yutou.tools.ToolsApplication;
|
import com.yutou.tools.ToolsApplication;
|
||||||
|
import com.yutou.tools.utils.QQBotManager;
|
||||||
|
import com.yutou.tools.utils.Tools;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
@ -16,26 +18,6 @@ import java.util.Enumeration;
|
|||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
public class tools {
|
public class tools {
|
||||||
|
|
||||||
@ResponseBody
|
|
||||||
@RequestMapping(value = "tools/cookie.do",method = RequestMethod.POST)
|
|
||||||
public String cookieToJson(HttpServletRequest request){
|
|
||||||
JSONObject json=new JSONObject();
|
|
||||||
JSONArray array=new JSONArray();
|
|
||||||
for (Cookie cookie : request.getCookies()) {
|
|
||||||
JSONObject item=new JSONObject();
|
|
||||||
item.put("name",cookie.getName());
|
|
||||||
item.put("value",cookie.getValue());
|
|
||||||
item.put("domain",cookie.getDomain());
|
|
||||||
item.put("path",cookie.getPath());
|
|
||||||
item.put("maxAge",cookie.getMaxAge());
|
|
||||||
item.put("secure",cookie.getSecure());
|
|
||||||
item.put("isHttpOnly",cookie.isHttpOnly());
|
|
||||||
array.add(item);
|
|
||||||
}
|
|
||||||
json.put("data",array);
|
|
||||||
return json.toJSONString();
|
|
||||||
}
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@RequestMapping(value = "tools/get.do")
|
@RequestMapping(value = "tools/get.do")
|
||||||
public String getJs(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
public String getJs(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||||
@ -62,9 +44,42 @@ public class tools {
|
|||||||
return str;
|
return str;
|
||||||
//return "function test(){ return \"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1588139022200&di=8cc8405f7514dd54bd82fcd070349603&imgtype=0&src=http%3A%2F%2Fa2.att.hudong.com%2F36%2F48%2F19300001357258133412489354717.jpg\" }";
|
//return "function test(){ return \"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1588139022200&di=8cc8405f7514dd54bd82fcd070349603&imgtype=0&src=http%3A%2F%2Fa2.att.hudong.com%2F36%2F48%2F19300001357258133412489354717.jpg\" }";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/public/version.do")
|
@RequestMapping("/public/version.do")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String getVersion() {
|
public String getVersion() {
|
||||||
return ToolsApplication.version;
|
return ToolsApplication.version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ResponseBody
|
||||||
|
@RequestMapping("/public/request.do")
|
||||||
|
public String testRequest(HttpServletRequest request) {
|
||||||
|
JSONObject params = new JSONObject();
|
||||||
|
JSONArray cookies = new JSONArray();
|
||||||
|
JSONObject header=new JSONObject();
|
||||||
|
for (String key : request.getParameterMap().keySet()) {
|
||||||
|
params.put(key, request.getParameter(key));
|
||||||
|
}
|
||||||
|
if (request.getCookies() != null) {
|
||||||
|
for (Cookie cookie : request.getCookies()) {
|
||||||
|
JSONObject ck = JSONObject.parseObject(JSONObject.toJSONString(cookie));
|
||||||
|
cookies.add(ck);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Enumeration<String> enumeration=request.getHeaderNames();
|
||||||
|
while (enumeration!=null&&enumeration.hasMoreElements()){
|
||||||
|
String tmp= enumeration.nextElement();
|
||||||
|
header.put(tmp,request.getHeader(tmp));
|
||||||
|
}
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
json.put("code", 0);
|
||||||
|
json.put("address", Tools.getRemoteAddress(request));
|
||||||
|
json.put("UA",request.getHeader(""));
|
||||||
|
json.put("addressUrl", request.getPathInfo());
|
||||||
|
json.put("params", params);
|
||||||
|
json.put("cookie", cookies);
|
||||||
|
json.put("header",header);
|
||||||
|
Tools.sendServer("打印请求", json.toJSONString());
|
||||||
|
return json.toJSONString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user