jsonStr = "{"+
"\"name\": \"名称\",\"abbrName\": \"简称\",\"eMail\": \"电子邮箱\","+
"\"process\": ["+
"{\"name\": \"甲\",\"level\": \"1\"},"+
"{\"name\": \"乙\",\"level\": \"2\"},"+
"}"
data:jsonStr
请教后台是get可以获取吗?若是不能怎么可以获取到?
public String getRequestPostStr(HttpServletRequest request) throws IOException{
byte buffer[] = getRequestPostBytes(request);
String charEncoding = request.getCharacterEncoding();
if(charEncoding == null){
charEncoding = "UTF-8";
}
return new String(buffer,charEncoding);
}
public byte[] getRequestPostBytes(HttpServletRequest request) throws IOException{
int contentLength = request.getContentLength();
if(contentLength<0){
return null;
}
byte[] buffer = new byte[contentLength];
for(int i = 0;i<contentLength;){
int readlen = request.getInputStream().read(buffer,i,contentLength - i);
if(readlen == -1){
break;
}
i += readlen;
}
return buffer;
}
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。