求解决java.net.SocketTimeoutException

化石 化石 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
ServletInputStream sis = request.getInputStream();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
String xmlInfo = null;
try {
do
{
byte[] temp = new byte[1024];
int bufferLength = sis.read(temp);
//上面这一句报java.net.SocketTimeoutException: if (bufferLength < 0)
{
break;
}
bos.write(temp, 0, bufferLength);
}
while (true);
xmlInfo = OpUtil.makeUnencry(bos.toByteArray());
xmlInfo = detailOpereatePost(request, response, xmlInfo);
} catch (Exception e) {
e.printStackTrace();
OpUtil.makeError("xmlInfo:" , e);
System.out.println(1111);
}
bos.flush();
bos.close();
if (null != xmlInfo)
{
ServletOutputStream out = response.getOutputStream();
byte[] bytes = OpUtil.makeEncry(xmlInfo);
out.write(bytes);
out.flush();
out.close();
}
}
...全文

相关推荐

评论 8
收藏 已收藏
分享
返回顶部
化石
Web 开发 81,108 成员 341,721 内容