use of org.apache.commons.httpclient.HttpMethod in project zm-mailbox by Zimbra.
the class ElasticSearchIndexTest method indexStoreAvailable.
@Override
protected boolean indexStoreAvailable() {
String indexUrl = String.format("%s?_status", LC.zimbra_index_elasticsearch_url_base.value());
HttpMethod method = new GetMethod(indexUrl);
try {
ElasticSearchConnector connector = new ElasticSearchConnector();
connector.executeMethod(method);
} catch (HttpException e) {
ZimbraLog.index.error("Problem accessing the ElasticSearch Index store", e);
return false;
} catch (IOException e) {
ZimbraLog.index.error("Problem accessing the ElasticSearch Index store", e);
return false;
}
return true;
}
use of org.apache.commons.httpclient.HttpMethod in project intellij-community by JetBrains.
the class GenericRepository method getHttpMethod.
private HttpMethod getHttpMethod(String requestUrl, HTTPMethod type) {
HttpMethod method = type == HTTPMethod.GET ? new GetMethod(requestUrl) : GenericRepositoryUtil.getPostMethodFromURL(requestUrl);
configureHttpMethod(method);
return method;
}
use of org.apache.commons.httpclient.HttpMethod in project intellij-community by JetBrains.
the class LighthouseRepository method doREST.
private HttpMethod doREST(String request, boolean post, HttpClient client) throws Exception {
String uri = getUrl() + request;
HttpMethod method = post ? new PostMethod(uri) : new GetMethod(uri);
configureHttpMethod(method);
client.executeMethod(method);
return method;
}
use of org.apache.commons.httpclient.HttpMethod in project intellij-community by JetBrains.
the class PivotalTrackerRepository method findTask.
@Nullable
@Override
public Task findTask(@NotNull final String id) throws Exception {
final String realId = getRealId(id);
if (realId == null)
return null;
final String url = API_URL + "/projects/" + myProjectId + "/stories/" + realId;
LOG.info("Retrieving issue by id: " + url);
final HttpMethod method = doREST(url, HTTPMethod.GET);
final InputStream stream = method.getResponseBodyAsStream();
final Element element = new SAXBuilder(false).build(stream).getRootElement();
return element.getName().equals("story") ? createIssue(element) : null;
}
use of org.apache.commons.httpclient.HttpMethod in project CloudStack-archive by CloudStack-extras.
the class StressTestDirectAttach method executeEventsAndBilling.
private static int executeEventsAndBilling(String server, String developerServer) throws HttpException, IOException {
// test steps:
// - get all the events in the system for all users in the system
// - generate all the usage records in the system
// - get all the usage records in the system
// -----------------------------
// GET EVENTS
// -----------------------------
String url = server + "?command=listEvents&page=1&account=" + _account.get();
s_logger.info("Getting events for the account " + _account.get());
HttpClient client = new HttpClient();
HttpMethod method = new GetMethod(url);
int responseCode = client.executeMethod(method);
s_logger.info("get events response code: " + responseCode);
if (responseCode == 200) {
InputStream is = method.getResponseBodyAsStream();
Map<String, List<String>> eventDescriptions = getMultipleValuesFromXML(is, new String[] { "description" });
List<String> descriptionText = eventDescriptions.get("description");
if (descriptionText == null) {
s_logger.info("no events retrieved...");
} else {
for (String text : descriptionText) {
s_logger.info("event: " + text);
}
}
} else {
s_logger.error("list events failed with error code: " + responseCode + ". Following URL was sent: " + url);
return responseCode;
}
return responseCode;
}
Aggregations