我无法弄清楚如何将以下curl命令的某些元素(例如-L或任何boolean / switch变量)复制到java http post
curl命令:
curl -L -XPOST localhost:4001/db?pretty -d 'some data'
到目前为止的httppost:
CloseableHttpClient httpClient=HttpClientBuilder.create().setRedirectStrategy(new LaxRedirectStrategy()).build();
HttpPost httpPost = new HttpPost(postURL);
httpPost.setEntity(new StringEntity(someData));
// httpPost.setEntity(new StringEntity("L")); This doesn't work
ResponseHandler<String> handler = new BasicResponseHandler();
CloseableHttpResponse response = httpClient.execute(httpPost);
message = handler.handleResponse(response);
提前致谢。