List of usage examples for org.apache.http.entity.mime MultipartEntityBuilder addTextBody
public MultipartEntityBuilder addTextBody(final String name, final String text)
From source file:org.roda.core.common.SeleniumUtils.java
private static void sendPostRequest(String source) { CloseableHttpClient httpClient = HttpClientBuilder.create().build(); MultipartEntityBuilder builder = MultipartEntityBuilder.create(); builder.addTextBody("input", source); HttpPost httpPost = new HttpPost("http://www.acessibilidade.gov.pt/accessmonitor/"); httpPost.setEntity(builder.build()); try {//from w w w.j av a 2s .co m CloseableHttpResponse response = httpClient.execute(httpPost); System.err.println(response); for (Header h : response.getAllHeaders()) { if ("location".equalsIgnoreCase(h.getName())) { locations.put(h.getValue(), driver.getCurrentUrl()); } } } catch (IOException e) { System.err.println("Error sending POST request!"); } }