@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()); } }
outboundPayload.addPart(0, report.getContentType(), "report", reportProps, bais); res.setContentType(outboundPayload.getContentType()); String commandName = req.getRequestURI().substring(getContextRoot().length() + 1);