added authentication to automated API call

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6711 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 15 years ago
parent 727dd9b193
commit 599c3766c4

@ -74,7 +74,7 @@ public class Table_API_p {
Tables.Row row = sb.tables.select(WorkTables.TABLE_API_NAME, pk.getBytes());
if (row != null) {
String url = "http://localhost:" + sb.getConfig("port", "8080") + new String(row.from(WorkTables.TABLE_API_COL_URL));
result = client.GET(url);
result = client.GET(url, Long.MAX_VALUE, sb.getConfig("adminAccountBase64MD5", ""));
l.put(url, result.getStatusCode());
}
} catch (IOException e) {

@ -233,7 +233,7 @@ public class Client {
apacheHttpClient.getParams().setIntParameter(HttpMethodParams.HEAD_BODY_CHECK_TIMEOUT, timeout);
apacheHttpClient.setConnectionTimeout(timeout);
}
/**
* should redirects automatically be followed?
*
@ -276,6 +276,14 @@ public class Client {
get.getParams().setCookiePolicy(CookiePolicy.IGNORE_COOKIES);
return execute(get);
}
public ResponseContainer GET(final String uri, long maxfilesize, String realm) throws IOException {
final HttpMethod get = new ClientGetMethod(uri, maxfilesize);
get.setFollowRedirects(followRedirects);
get.getParams().setCookiePolicy(CookiePolicy.IGNORE_COOKIES);
get.setRequestHeader("Authorization", "realm=" + realm);
return execute(get);
}
/**
* This method gets only the header of a page.

Loading…
Cancel
Save