跳转修改

version1
admin 2 years ago
parent b99c66a7f0
commit 6d43783fb5

@ -1,7 +1,5 @@
package com.glxp.sale.admin.idc.controller;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
@ -9,7 +7,6 @@ import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseEntity;
@ -98,7 +95,7 @@ public class IdcController {
RestTemplate restTemplate = new RestTemplate();
Map<String,Object> headerParam = getAllReaderParam(request);
Map<String,Object> headerParam = new HashMap<>();
Map<String, Object> bodyParam = new HashMap<String,Object>();
Enumeration pNames=request.getParameterNames();
while(pNames.hasMoreElements()){
@ -106,12 +103,18 @@ public class IdcController {
String value=request.getParameter(name);
bodyParam.put(name, value);
}
HttpHeaders headers = new HttpHeaders();
Enumeration<String> enumeration = request.getHeaderNames();
while (enumeration.hasMoreElements()) {
String name = enumeration.nextElement();
String value = request.getHeader(name);
headerParam.put(name, value);
headers.add(name, value);
}
//headers.add("Content-Type", "application/json;charset=UTF-8");
for(String key : headerParam.keySet()){
headers.add(key, headerParam.get(key).toString());
}
System.out.print(JSON.toJSONString(headerParam));
System.out.print(JSON.toJSONString(bodyParam));
HttpEntity<String> http = new HttpEntity<>(JSON.toJSONString(bodyParam), headers);
@ -121,30 +124,7 @@ public class IdcController {
}
private Map<String,Object> getAllReaderParam(HttpServletRequest request) {
Map<String,Object> result = new HashMap<>();
BufferedReader br;
try {
br = request.getReader();
if(br!=null) {
System.out.print("-----------------------");
System.out.print(br.readLine());
}
String str, wholeStr = "";
while((str = br.readLine()) != null){
wholeStr += str;
System.out.print(str);
}
if(!StringUtils.isEmpty(wholeStr)) {
result = JSON.parseObject(wholeStr);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return result;
}
private String parseUri(String url) {
String uri = url;
int a1 = uri.indexOf("://");

Loading…
Cancel
Save