局域网内本地服务器发送至其他服务器:
前端$.ajax请求json报文至后台(servlet)服务器request无法得到json参数,求大神!
前端代码: function doPost(){
var person = {
ServiceCode:'DHE002',
cus_id:'23333333',
cus_name:'杭州市XX橡胶股份有限公司',
if_renew:'1',
apply_amt:'1200000',
apply_term:'12',
work_addr:'XX路XX号',
contacts:'老何',
contact_number:'13333333333'
};
var option = {
url: 'http://127.0.0.1:8088/cmis/CrcbHttpFromICF',
type: 'POST',
data: JSON.stringify(person),
dataType: 'html',
contentType: 'application/x-www-form-urlencoded',
success: function (result) { alert(result); }
};
$.ajax(option);
}
后端:
public void service(HttpServletRequest request, HttpServletResponse response) {
}
InputStream in = request.getInputStream(); //无法取到参数
图片为后端request值,其中:content-length = -1
本地发本地没有问题,可以收到参数:content-length = 224
求大神!!!!!!!!!!
本地发本地 headers对象值为:
=== MimeHeaders ===
host = 127.0.0.1:8088
connection = keep-alive
content-length = 224
accept = text/html, */*
origin = http://127.0.0.1:8088
x-requested-with = XMLHttpRequest
user-agent = Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
content-type = application/json
referer = http://127.0.0.1:8088/cmis/getLocalHttpTestPage.do?EMP_SID=HDDVITEEBSGPEYAYFZBSDZGZJACVFRGDDFEOGBCU&menuId=httptest
accept-encoding = gzip, deflate, br
accept-language = zh-CN,zh;q=0.8
cookie = cstrees.cus=midkhslsq_treenode; cotrees.cus=; cotrees.wdgzt=; topic=xtheme-green.css; skin=default-green.css; extCss=2; mainSkin=infoGreen.css; cotrees.xtpz=; JSESSIONID=4A9D7E38B16E2B1C892B5675DFD8A315; cstrees.xtpz=httptest_treenode; __guid=96992031.3003261057912573000.1517106957683.7715; monitor_count=11
本地发服务器headers对象值为:
=== MimeHeaders ===
host = 172.16.1.54:8088
connection = keep-alive
access-control-request-method = POST
origin = http://127.0.0.1:8080
user-agent = Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36
access-control-request-headers = content-type,x-requested-with
accept = */*
accept-encoding = gzip, deflate
accept-language = zh-CN,zh;q=0.9