@RequestMapping(value = "test", method = RequestMethod.POST)
public Result receive(HttpServletRequest request) throws UnsupportedEncodingException {
InputStream is = null;
StringBuilder sb = new StringBuilder();
try {
is = request.getInputStream();
byte[] b = new byte[4096];
for (int n; (n = is.read(b)) != -1; ) {
sb.append(new String(b, 0, n, "GBK"));
}
} catch (IOException e) {
e.printStackTrace();
} finally {
if (null != is) {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
LOGGER.info("接收到原始信息{}", sb);
}
Controller层接收JSON数据GBK乱码问题解决
猜你喜欢
转载自blog.csdn.net/2301_76354366/article/details/130279679
今日推荐
周排行