update:nas ip
update:/public/request.do add:/public/file/request.do
This commit is contained in:
parent
10c6967869
commit
6c4fbc47ab
@ -21,7 +21,7 @@ import java.util.regex.Pattern;
|
|||||||
@Controller
|
@Controller
|
||||||
public class UpdateIp {
|
public class UpdateIp {
|
||||||
private static List<String> keys = new ArrayList<>();
|
private static List<String> keys = new ArrayList<>();
|
||||||
public static String nas_ip=null;
|
public static String nas_ip="nas.yutou233.cn";
|
||||||
static {
|
static {
|
||||||
if ("dev".equals(ConfigTools.load(ConfigTools.CONFIG, "model"))) {
|
if ("dev".equals(ConfigTools.load(ConfigTools.CONFIG, "model"))) {
|
||||||
nas_ip="192.168.31.88";
|
nas_ip="192.168.31.88";
|
||||||
|
@ -15,7 +15,9 @@ import org.springframework.http.ResponseEntity;
|
|||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.Cookie;
|
import javax.servlet.http.Cookie;
|
||||||
@ -24,8 +26,11 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
public class tools {
|
public class tools {
|
||||||
@ -68,7 +73,13 @@ public class tools {
|
|||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@RequestMapping("/public/request.do")
|
@RequestMapping("/public/request.do")
|
||||||
|
|
||||||
public String testRequest(HttpServletRequest request) {
|
public String testRequest(HttpServletRequest request) {
|
||||||
|
return testRequest(request, null);
|
||||||
|
}
|
||||||
|
@ResponseBody
|
||||||
|
@RequestMapping("/public/file/request.do")
|
||||||
|
public String testRequest(HttpServletRequest request, @RequestParam("file")MultipartFile file) {
|
||||||
JSONObject params = new JSONObject();
|
JSONObject params = new JSONObject();
|
||||||
JSONArray cookies = new JSONArray();
|
JSONArray cookies = new JSONArray();
|
||||||
JSONObject header = new JSONObject();
|
JSONObject header = new JSONObject();
|
||||||
@ -81,14 +92,19 @@ public class tools {
|
|||||||
cookies.add(ck);
|
cookies.add(ck);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||||
|
try {
|
||||||
BufferedInputStream stream = new BufferedInputStream(request.getInputStream());
|
BufferedInputStream stream = new BufferedInputStream(request.getInputStream());
|
||||||
byte[] bytes = new byte[1024];
|
byte[] bytes = new byte[1024];
|
||||||
int len = 0, size;
|
int len = 0, size;
|
||||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
|
||||||
while ((len = stream.read(bytes)) != -1) {
|
while ((len = stream.read(bytes)) != -1) {
|
||||||
outputStream.write(bytes, 0, len);
|
outputStream.write(bytes, 0, len);
|
||||||
outputStream.flush();
|
outputStream.flush();
|
||||||
}
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
Enumeration<String> enumeration = request.getHeaderNames();
|
Enumeration<String> enumeration = request.getHeaderNames();
|
||||||
while (enumeration != null && enumeration.hasMoreElements()) {
|
while (enumeration != null && enumeration.hasMoreElements()) {
|
||||||
String tmp = enumeration.nextElement();
|
String tmp = enumeration.nextElement();
|
||||||
@ -107,6 +123,14 @@ public class tools {
|
|||||||
json.put("header", header);
|
json.put("header", header);
|
||||||
System.out.println("json = " + json);
|
System.out.println("json = " + json);
|
||||||
// Tools.sendServer("打印请求", json.toJSONString());
|
// Tools.sendServer("打印请求", json.toJSONString());
|
||||||
|
if(file!=null){
|
||||||
|
try {
|
||||||
|
Tools.createFile("tmp",file,new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA).format(new Date())+".zip");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Tools.sendServer("打印请求", json.toJSONString());
|
||||||
try {
|
try {
|
||||||
switch (RedisTools.get("request")) {
|
switch (RedisTools.get("request")) {
|
||||||
case "success":
|
case "success":
|
||||||
|
Loading…
Reference in New Issue
Block a user