bug记录(1)
来源:互联网 发布:.net程序员面试宝典 编辑:程序博客网 时间:2024/06/07 06:49
第一个:
在编写一个远程调用接口时,远程传过来的是一个PDF报表文件,PrintWrite打印出来。在用httpclient远程访问时,发现打印报表为空白。
public String postreport(String url, Map<String, String> params) { String resp = null; CloseableHttpClient httpclient = HttpClients.createDefault(); HttpPost httppost = new HttpPost(url); List<NameValuePair> formparams = new ArrayList<NameValuePair>(); Set<String> keySet = params.keySet(); for (String key : keySet) { formparams.add(new BasicNameValuePair(key, params.get(key))); } try { UrlEncodedFormEntity uefEntity = new UrlEncodedFormEntity(formparams, ApplicationConstant.UTF_8); httppost.addHeader("Content-type", "application/x-www-form-urlencoded; charset=utf-8"); httppost.setHeader("Accept", "application/json"); uefEntity.setContentType("text/json"); httppost.setEntity(uefEntity); httppost.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, 600000); CloseableHttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); if (entity != null) { //这里是问题所在。去掉后面的编码就能正常打印报表 <span style="color:#FF0000;">resp = EntityUtils.toString(entity, ApplicationConstant.UTF_8);</span> } response.close(); } catch (IOException e) { LOGGER.error("HttpClientUtil.post(),{}", e); resp = ApplicationConstant.FAIL_CODE; } finally { try { httpclient.close(); } catch (IOException e) { LOGGER.error("HttpClientUtil.post(),{}", e); resp = ApplicationConstant.FAIL_CODE; } } return resp; }
第二个:
请求远程Jasperreports报表接口时,每次调用发现接口运行了2次。研究发现这与浏览器下载机制有关。Google和火狐都会出现这种情况,而IE却不会。先这样,下次在具体补充。
0 0
- bug记录(1)
- ccms bug记录1
- 小bug记录1
- bug记录1
- 记录BUG
- bug 记录
- bug记录
- bug记录
- bug记录
- BUG记录:
- BUG记录:
- BUG记录
- bug 记录
- bug记录
- Bug记录
- BUG 记录
- [BUG 记录]
- Bug记录
- Android Studio 解决手机无法识别问题
- linux 命令汇集(不断更新中)。
- U盘防拷精灵 v1.3
- thinkphp 公共模板和模板布局--基础操作
- java 流程控制
- bug记录(1)
- 你条件很好,可我想跟你分手
- 策略模式
- 解决android启动黑白屏最简洁的方式 一行代码搞定
- Three.js入门01
- [LeetCode] 56. Merge Intervals
- hdu1720
- 企业数据可视化管理下的实践
- springmvc路由访问及数据传递