Advertisement
BoberDiversant

Untitled

Sep 29th, 2019
425
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.75 KB | None | 0 0
  1. public String sendResult(ResultSendRequest resultSendRequest) {
  2.         try {
  3.             HttpPost httpPost = new HttpPost("http://176.99.11.185:33036/ivtest/0d5260f47e283b30426945d80a4f20d3");
  4.             httpPost.addHeader("Content-type", "application/json");
  5.             httpPost.setHeader("http.protocol.content-charset", "UTF-8");
  6.             StringEntity stringEntity = new StringEntity(new Gson().toJson(resultSendRequest), StandardCharsets.UTF_8);
  7.             httpPost.setEntity(stringEntity);
  8.             CloseableHttpResponse response = httpClient.execute(httpPost);
  9.             return new BasicResponseHandler().handleResponse(response);
  10.         } catch (IOException e) {
  11.             e.printStackTrace();
  12.             return "error";
  13.         }
  14.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement