I'm starting in the programming world and have to refactor a routine using another library. The routine uses the apache lib to do Http requests org.apache.http.*
, I have to refactor using Jax-RS.
Here is the example of the routine I have to rewrite:
final SSLConnectionSocketFactory sslSocketFactory = new SSLConnectionSocketFactory(
new BBRSocketFactory(config).getContext());
try (final CloseableHttpClient httpClient = HttpClients.custom().setSSLSocketFactory(sslSocketFactory)
.build()) {
final HttpPost request = new HttpPost(config.getAmbiente().getUrl());
request.setHeader("Content-Type", "application/pkcs7-signature");
request.setEntity(new StringEntity(dadoEntradaAssinadoBase64));
final HttpResponse response = httpClient.execute(request);
System.out.println("Response status: " + response.getStatusLine().getStatusCode());
final String stringResposta = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
System.out.println("Resposta string: " + stringResposta);
Questions:
- What is the equivalent lib / Documentation.
- What are the corresponding methods.
Could someone help me with the direction of how to do it, or even with some example?