* @return
* @throws org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException
*/
static HTTPNetServiceComponentConfiguration createComponentConfiguration(Configuration pluginConfig) {
URL endPointUrl = null;
String configUrl = pluginConfig.getSimpleValue(URL, EMPTY_STRING);
if (isBlank(configUrl)) {
throw new InvalidPluginConfigurationException("Endpoint URL is not defined");
}
try {
endPointUrl = new URL(configUrl);
} catch (MalformedURLException e) {
throw new InvalidPluginConfigurationException(configUrl + " is not a valid URL");
}
String protocol = endPointUrl.getProtocol();
if (!protocol.equals("http") && !protocol.equals("https")) {
throw new InvalidPluginConfigurationException(configUrl + "does not point to an http(s) resource");
}
HttpMethod httpMethod = null;