mirror of
https://github.com/Fishwaldo/rundeck-api-java-client.git
synced 2025-07-08 14:08:33 +00:00
Deprecation fix apache.httpcomponents
fix deprecation due to apache.httpcomponents upgrade and fixing some code warnings
This commit is contained in:
parent
b3839f089b
commit
c1a1f3c365
1 changed files with 19 additions and 20 deletions
|
@ -37,7 +37,6 @@ import org.apache.http.params.HttpProtocolParams;
|
|||
import org.apache.http.protocol.HTTP;
|
||||
import org.apache.http.protocol.HttpContext;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.dom4j.Document;
|
||||
import org.rundeck.api.RundeckApiException.RundeckApiLoginException;
|
||||
import org.rundeck.api.RundeckApiException.RundeckApiTokenException;
|
||||
import org.rundeck.api.parser.ParserHelper;
|
||||
|
@ -639,11 +638,11 @@ class ApiCall {
|
|||
while (true) {
|
||||
try {
|
||||
HttpPost postLogin = new HttpPost(location);
|
||||
List params = new ArrayList();
|
||||
List<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
|
||||
params.add(new BasicNameValuePair("j_username", client.getLogin()));
|
||||
params.add(new BasicNameValuePair("j_password", client.getPassword()));
|
||||
params.add(new BasicNameValuePair("action", "login"));
|
||||
postLogin.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8));
|
||||
postLogin.setEntity(new UrlEncodedFormEntity(params, Consts.UTF_8));
|
||||
HttpResponse response = httpClient.execute(postLogin);
|
||||
|
||||
if (response.getStatusLine().getStatusCode() / 100 == 3) {
|
||||
|
@ -663,7 +662,7 @@ class ApiCall {
|
|||
}
|
||||
|
||||
try {
|
||||
String content = EntityUtils.toString(response.getEntity(), HTTP.UTF_8);
|
||||
String content = EntityUtils.toString(response.getEntity(), Consts.UTF_8);
|
||||
if (StringUtils.contains(content, "j_security_check")) {
|
||||
throw new RundeckApiLoginException("Login failed for user " + client.getLogin());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue