use of org.opennms.netmgt.config.httpdatacollection.Url in project opennms by OpenNMS.
the class HttpCollector method buildHttpMethod.
private static HttpRequestBase buildHttpMethod(final HttpCollectorAgent collectorAgent) throws URISyntaxException {
HttpRequestBase method;
final URI uri = buildUri(collectorAgent);
final Url url = collectorAgent.getUriDef().getUrl();
if ("GET".equals(url.getMethod())) {
method = buildGetMethod(uri, collectorAgent);
} else {
method = buildPostMethod(uri, collectorAgent);
}
if (url.getVirtualHost().isPresent()) {
final String virtualHost = url.getVirtualHost().get();
if (!virtualHost.trim().isEmpty()) {
method.setHeader(HTTP.TARGET_HOST, virtualHost);
}
}
return method;
}
Aggregations