use of org.apache.http.entity.mime.MultipartEntity in project undertow by undertow-io.
the class ParameterCharacterEncodingTestCase method testMultipartCharacterEncoding.
@Test
public void testMultipartCharacterEncoding() throws IOException {
TestHttpClient client = new TestHttpClient();
try {
String message = "abcčšž";
String charset = "UTF-8";
HttpPost post = new HttpPost(DefaultServer.getDefaultServerURL() + "/servletContext");
MultipartEntity multipart = new MultipartEntity();
multipart.addPart("charset", new StringBody(charset, Charset.forName(charset)));
multipart.addPart("message", new StringBody(message, Charset.forName(charset)));
post.setEntity(multipart);
HttpResponse result = client.execute(post);
Assert.assertEquals(StatusCodes.OK, result.getStatusLine().getStatusCode());
String response = HttpClientUtils.readResponse(result);
Assert.assertEquals(message, response);
} finally {
client.getConnectionManager().shutdown();
}
}
use of org.apache.http.entity.mime.MultipartEntity in project stanbol by apache.
the class ReasonersOfflineTest method setupMultipart.
@Before
public void setupMultipart() {
FileBody bin = new FileBody(file);
multiPart = new MultipartEntity();
multiPart.addPart(fileParam, bin);
}
Aggregations