Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. // Send normal param.
  2. writer.append("-----------").append(CRLF);
  3. writer.append("Content-Disposition: form-data; name=\"params\"").append(CRLF);
  4. writer.append("Content-Type: text/plain; charset=" + WEBSERVICE_JIRA_CHARSET).append(CRLF);
  5. writer.append("Content-Length: " + String.valueOf(postData.length).toString()).append(CRLF);
  6. writer.append(CRLF).append(sb.toString()).append(CRLF).flush();
  7. // Send text file.
  8.  
  9. if(instance.isAttachmentsSpecified()) {
  10. for(int i = 0; i < instance.getAttachments().getAttachment().length; i++) {
  11. writer.append("-----------").append(CRLF);
  12. writer.append("Content-Disposition: form-data; name=\"binaryFile\"; filename=\"" + instance.getAttachments().getAttachment()[i].getName().toString() + "\"").append(CRLF);
  13. writer.append("Content-Type: " + instance.getAttachments().getAttachment()[i].getType().toString()).append(CRLF);
  14. writer.append("Content-Length: " + instance.getAttachments().getAttachment()[i].getLen()).append(CRLF);
  15. writer.append("Content-Action: " + instance.getAttachments().getAttachment()[i].getAction()).append(CRLF);
  16. writer.append("Content-Transfer-Encoding: binary").append(CRLF);
  17. writer.append(CRLF).flush();
  18. output.write(instance.getQuery().getBytes());
  19. output.flush(); // Important before continuing with writer!
  20. writer.append(CRLF).flush(); // CRLF is important! It indicates end of boundary.
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement