Package org.asynchttpclient.multipart

Examples of org.asynchttpclient.multipart.FilePart


    public void testUnauthorizedWhileUploading() throws Exception {
        File file = createTempFile(1024 * 1024);

        AsyncHttpClient client = getAsyncHttpClient(null);
        try {
            Response response = client.preparePut(getTargetUrl()).addBodyPart(new FilePart("test", file, "application/octet-stream", UTF_8)).execute()
                    .get();
            assertEquals(response.getStatusCode(), 401);
        } finally {
            client.close();
        }
View Full Code Here


    @Test(groups = { "standalone", "default_provider" }, enabled = true)
    public void testPutImageFile() throws Exception {
        AsyncHttpClient client = getAsyncHttpClient(new AsyncHttpClientConfig.Builder().setRequestTimeout(100 * 6000).build());
        try {
            Response response = client.preparePut(getTargetUrl()).addBodyPart(new FilePart("test", LARGE_IMAGE_FILE, "application/octet-stream", UTF_8)).execute().get();
            assertEquals(response.getStatusCode(), 200);
        } finally {
            client.close();
        }
    }
View Full Code Here

    public void testPutLargeTextFile() throws Exception {
        File file = createTempFile(1024 * 1024);

        AsyncHttpClient client = getAsyncHttpClient(null);
        try {
            Response response = client.preparePut(getTargetUrl()).addBodyPart(new FilePart("test", file, "application/octet-stream", UTF_8)).execute().get();
            assertEquals(response.getStatusCode(), 200);
        } finally {
            client.close();
        }
    }
View Full Code Here

        try {

            RequestBuilder builder = new RequestBuilder("POST");
            builder.setUrl("http://localhost" + ":" + port1 + "/upload/bob");
            builder.addBodyPart(new FilePart("file1", testResource1File, "text/plain", UTF_8));
            builder.addBodyPart(new FilePart("file2", testResource2File, "application/x-gzip", null));
            builder.addBodyPart(new StringPart("Name", "Dominic"));
            builder.addBodyPart(new FilePart("file3", testResource3File, "text/plain", UTF_8));

            builder.addBodyPart(new StringPart("Age", "3"));
            builder.addBodyPart(new StringPart("Height", "shrimplike"));
            builder.addBodyPart(new StringPart("Hair", "ridiculous"));
View Full Code Here

TOP

Related Classes of org.asynchttpclient.multipart.FilePart

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.