首页 > 代码库 > 前端用Request Payload方式请求后台

前端用Request Payload方式请求后台

后台接收方式:

 

InputStream inputStream = request.getInputStream();

byte[] buff = new byte[1024];
int len = -1;
while (-1 != (len = inputStream.read(buff))) {
// 将字节数组转换为字符串,并且设置为“UTF-8”格式编码(不然会出现乱码)
String res = new String(buff, 0, len,"UTF-8");
jsonObject = new org.json.JSONObject(res);

int offset = jsonObject.getInt("offset");
int limit = jsonObject.getInt("limit");
}

前端用Request Payload方式请求后台