I woudlike to put some parameter in my request (code value and name value) :
String code = "001";
String name = "AAA";
HttpGet request = new HttpGet(url);
String auth = user + ":" + mdp;
byte[] encodedAuth = Base64.encodeBase64(
auth.getBytes(StandardCharsets.ISO_8859_1));
String authHeader = "Basic " + new String(encodedAuth);
request.setHeader(HttpHeaders.AUTHORIZATION, authHeader);
HttpClient client = HttpClientBuilder.create().build();
HttpResponse response = client.execute(request);
int statusCode = response.getStatusLine().getStatusCode();
How can I do this with authentification request ?
Something like : code=001&name=AAA in the URL
url, e.g.,url += "?" + code=001&name=AAA". This is somewhat ugly, so there are probably (hopefully) more elegant ways to build the string used inHttpGet. Those parameters should also be properly encoded.