urlString = urlString.replaceAll("\\n", "");
urlString = urlString.replaceAll("\\t", "");
urlString = urlString.replaceAll("\\r", "");
urlString = urlString.replaceAll(" ", "");
HttpClientRequest client = HttpClientRequest.newRequest();
client.setBatchHttpClient(getBatchHttpClient());
client.setUrl(urlString);
client.setRetries(1);
usr = Val.chkStr(usr);
pwd = Val.chkStr(pwd);
if (usr.length() > 0 || pwd.length() > 0) {
CredentialProvider provider = new CredentialProvider(usr, pwd);
client.getCredentialProvider();
client.setCredentialProvider(provider);
}
if (this.getReadTimeout() > 0) {
client.setResponseTimeOutMs(this.getReadTimeout());
}
if (this.getConnectTimeout() > 0) {
client.setConnectionTimeMs(this.getConnectTimeout());
}
// Send a request
if (Val.chkStr(method).equalsIgnoreCase("post")) {
ContentProvider contentProvider = new StringProvider(postdata, "text/xml");
client.setContentProvider(contentProvider);
} else {
client.setMethodName(MethodName.GET);
}
String response = client.readResponseAsCharacters();
LOG.finer(" CSW Response : " + response);
return new ByteArrayInputStream(response.getBytes("UTF-8"));
}