private void write() { OutputStream out = null; try { out = new BufferedOutputStream(new FileOutputStream(syncBundleExport)); payload.writeTo(out); } catch (IOException ex) { setError(Strings.get("export.sync.bundle.exportFailed", syncBundleExport.getAbsolutePath(), ex.getLocalizedMessage())); } finally { if (out != null) { try { out.close(); } catch (IOException ex) { logger.warning(Strings.get("export.sync.bundle.closeStreamFailed", syncBundleExport.getAbsolutePath(), ex.getLocalizedMessage())); } } } if (!isRetrieve) { if (syncBundleExport.isFile()) { report.setMessage(Strings.get("export.sync.bundle.success", syncBundleExport.getAbsolutePath())); } else { setError(Strings.get("export.sync.bundle.fail", syncBundleExport.getAbsolutePath())); } } }
private void write() { OutputStream out = null; try { out = new BufferedOutputStream(new FileOutputStream(syncBundleExport)); payload.writeTo(out); } catch (IOException ex) { setError(Strings.get("export.sync.bundle.exportFailed", syncBundleExport.getAbsolutePath(), ex.getLocalizedMessage())); } finally { if (out != null) { try { out.close(); } catch (IOException ex) { logger.warning(Strings.get("export.sync.bundle.closeStreamFailed", syncBundleExport.getAbsolutePath(), ex.getLocalizedMessage())); } } } if (!isRetrieve) { if (syncBundleExport.isFile()) { report.setMessage(Strings.get("export.sync.bundle.success", syncBundleExport.getAbsolutePath())); } else { setError(Strings.get("export.sync.bundle.fail", syncBundleExport.getAbsolutePath())); } } }
outboundPayload.writeTo(targetStream); targetStream.flush(); targetStream.close();
res.addHeader(SET_COOKIE_HEADER, getCookieHeader(req)); outboundPayload.writeTo(res.getOutputStream()); res.getOutputStream().flush(); res.finish();
outboundPayload.writeTo(targetStream); targetStream.flush();
outboundPayload.writeTo(payloadOutputStream); payloadOutputStream.flush(); payloadOutputStream.close();
outboundPayload.writeTo(payloadOutputStream); payloadOutputStream.flush(); payloadOutputStream.close();
@Override public void prepareConnection(final HttpURLConnection urlConnection) throws IOException { if (doUpload) { /* * If we are uploading anything then set the content-type * and add the uploaded part(s) to the payload. */ urlConnection.setChunkedStreamingMode(0); // use default value urlConnection.setRequestProperty("Content-Type", outboundPayload.getContentType()); } // add any user-specified headers for (Header h : requestHeaders) { urlConnection.addRequestProperty(h.getName(), h.getValue()); } if (doUpload) { outboundPayload.writeTo(urlConnection.getOutputStream()); } }
@Override public void prepareConnection(final HttpURLConnection urlConnection) throws IOException { if (doUpload) { /* * If we are uploading anything then set the content-type * and add the uploaded part(s) to the payload. */ urlConnection.setChunkedStreamingMode(0); // use default value urlConnection.setRequestProperty("Content-Type", outboundPayload.getContentType()); } // add any user-specified headers for (Header h : requestHeaders) urlConnection.addRequestProperty(h.getName(), h.getValue()); if (doUpload) { outboundPayload.writeTo(urlConnection.getOutputStream()); } }