public void uploadToFileNodes()

in src/main/java/org/apache/sling/commons/testing/integration/SlingIntegrationTestClient.java [238:261]


    public void uploadToFileNodes(String url, File[] localFiles, String[] fieldNames, String[] typeHints)
        throws IOException {

    	List<Part> partsList = new ArrayList<Part>();
    	for (int i=0; i < localFiles.length; i++) {
            Part filePart = new FilePart(fieldNames[i], localFiles[i]);
            partsList.add(filePart);
            if (typeHints != null) {
            	Part typeHintPart = new StringPart(fieldNames[i] + "@TypeHint", typeHints[i]);
            	partsList.add(typeHintPart);
            }
		}

        final Part[] parts = partsList.toArray(new Part[partsList.size()]);
        final PostMethod post = new PostMethod(url);
        post.setFollowRedirects(false);
        post.setRequestEntity(new MultipartRequestEntity(parts, post.getParams()));

        final int expected = 200;
        final int status = httpClient.executeMethod(post);
        if(status!=expected) {
            throw new HttpStatusCodeException(expected, status, "POST", HttpTestBase.getResponseBodyAsStream(post, 0));
        }
    }