@@ -0,0 +1,2382 @@
+package me.automationdomination.plugins.threadfix;%0A%0Apublic class ThreadfixUploadService %7B%0A%09%0A%09// 05/29/2014: copied from threadfix cli%0A//%09public RestResponse%3CScan%3E uploadScan(String applicationId, String filePath) %7B%0A//%09%09return httpRestUtils.httpPostFile(%22/applications/%22 + applicationId + %22/upload%22,%0A//                new File(filePath), new String%5B%5D%7B%7D, new String%5B%5D%7B%7D, Scan.class);%0A//%09%7D%0A//%09%0A//    @NotNull%0A//%09public %3CT%3E RestResponse%3CT%3E httpPostFile(@NotNull String path,%0A//                                            @NotNull File file,%0A//                                            @NotNull String%5B%5D paramNames,%0A//                                            @NotNull String%5B%5D paramVals,%0A//                                            @NotNull Class%3CT%3E targetClass) %7B%0A//%0A//%09%09//%09TODO - Revisit how we handle certificate errors here%0A//%09%09Protocol.registerProtocol(%22https%22, new Protocol(%22https%22, new AcceptAllTrustFactory(), 443));%0A//%0A//        String completeUrl = makePostUrl(path);%0A//%0A//%09%09PostMethod filePost = new PostMethod(completeUrl);%0A//%0A//%09%09filePost.setRequestHeader(%22Accept%22, %22application/json%22);%0A//%0A//        RestResponse%3CT%3E response;%0A//        int status = -1;%0A//%0A//%09%09try %7B%0A//%09%09%09Part%5B%5D parts = new Part%5BparamNames.length + 2%5D;%0A//%09%09%09parts%5BparamNames.length%5D = new FilePart(%22file%22, file);%0A//            parts%5BparamNames.length + 1%5D = new StringPart(%22apiKey%22, propertiesManager.getKey());%0A//%0A//%09%09%09for (int i = 0; i %3C paramNames.length; i++) %7B%0A//%09%09%09%09parts%5Bi%5D = new StringPart(paramNames%5Bi%5D, paramVals%5Bi%5D);%0A//%09%09%09%7D%0A//%0A//%09%09%09filePost.setRequestEntity(new MultipartRequestEntity(parts,%0A//%09%09%09%09%09filePost.getParams()));%0A//%0A//%09%09%09filePost.setContentChunked(true);%0A//%09%09%09HttpClient client = new HttpClient();%0A//            status = client.executeMethod(filePost);%0A//%0A//%09%09%09if (status != 200) %7B%0A//                LOGGER.warn(%22Request for '%22 + completeUrl + %22' status was %22 + status + %22, not 200 as expected.%22);%0A//%09%09%09%7D%0A//%0A//            response = ResponseParser.getRestResponse(filePost.getResponseBodyAsStream(), status, targetClass);%0A//%0A//        %7D catch (IOException e1) %7B%0A//            LOGGER.error(%22There was an error and the POST request was not finished.%22, e1);%0A//            response = ResponseParser.getErrorResponse(%0A//                    %22There was an error and the POST request was not finished.%22,%0A//                    status);%0A//        %7D%0A//%0A//        return response;%0A//    %7D%0A%0A%7D%0A

add copy/pasted code from threadfix cli