Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Send normal param.
- writer.append("-----------").append(CRLF);
- writer.append("Content-Disposition: form-data; name=\"params\"").append(CRLF);
- writer.append("Content-Type: text/plain; charset=" + WEBSERVICE_JIRA_CHARSET).append(CRLF);
- writer.append("Content-Length: " + String.valueOf(postData.length).toString()).append(CRLF);
- writer.append(CRLF).append(sb.toString()).append(CRLF).flush();
- // Send text file.
- if(instance.isAttachmentsSpecified()) {
- for(int i = 0; i < instance.getAttachments().getAttachment().length; i++) {
- writer.append("-----------").append(CRLF);
- writer.append("Content-Disposition: form-data; name=\"binaryFile\"; filename=\"" + instance.getAttachments().getAttachment()[i].getName().toString() + "\"").append(CRLF);
- writer.append("Content-Type: " + instance.getAttachments().getAttachment()[i].getType().toString()).append(CRLF);
- writer.append("Content-Length: " + instance.getAttachments().getAttachment()[i].getLen()).append(CRLF);
- writer.append("Content-Action: " + instance.getAttachments().getAttachment()[i].getAction()).append(CRLF);
- writer.append("Content-Transfer-Encoding: binary").append(CRLF);
- writer.append(CRLF).flush();
- output.write(instance.getQuery().getBytes());
- output.flush(); // Important before continuing with writer!
- writer.append(CRLF).flush(); // CRLF is important! It indicates end of boundary.
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement