Map<String, List<String>> head = connection.getHeaderFields();
resHead.putAll(head);
}
- InputStream is = connection.getInputStream();
- BufferedInputStream bis = null;
- try {
- bis = new BufferedInputStream(is);
- byte[] buf = new byte[2048];
- int rd = 0;
- while((rd = bis.read(buf)) > 0) {
- out.append(buf, 0, rd);
- }
- } finally {
- if (bis != null) {
- try {
- bis.close();
- } catch (IOException e) {
- // Ignore
+ if (rc == HttpServletResponse.SC_OK) {
+ InputStream is = connection.getInputStream();
+ BufferedInputStream bis = null;
+ try {
+ bis = new BufferedInputStream(is);
+ byte[] buf = new byte[2048];
+ int rd = 0;
+ while((rd = bis.read(buf)) > 0) {
+ out.append(buf, 0, rd);
+ }
+ } finally {
+ if (bis != null) {
+ try {
+ bis.close();
+ } catch (IOException e) {
+ // Ignore
+ }
}
}
}