I have an MultipartEntity declared like this:
MultipartEntity httpEnt = new MultipartEntity();
httpEnt.addPart("Test", new StringBody("test", ContentType.TEXT_PLAIN));
Then I make a rest call like this
HttpPost http = new HttPost(url);
HttpClient httpClient = HttpClients.createDefault();
http.setEntity(httpEnt);
httpClient.execute(http);
The MultipartyEntity seems to be deprecated and not working. I was considering using HttpEntity like this:
HttpEntity httpEnt = MultipartEntityBuilder.create().addPart("test", new StringBody(....)).build();
the problem with this is I want to add multiple parts in different methods and then later build. It seems like if I do it this way I will need to attach all parts at once and build in one line of code. Can I still use the deprecated one? A better way to do this?