int proxyUserDomainIndex = proxyUser.indexOf("\\");
if (proxyUserDomainIndex > 0) {
String domain = proxyUser.substring(0, proxyUserDomainIndex);
if (proxyUser.length() > proxyUserDomainIndex + 1) {
String user = proxyUser.substring(proxyUserDomainIndex + 1);
proxyCredentials = new NTCredentials(user, proxyPassword, proxyHost,
domain);
}
}
}
}
// If there is runtime proxy settings, these settings will override
// settings from axis2.xml
HttpTransportProperties.ProxyProperties proxyProperties =
(HttpTransportProperties.ProxyProperties) messageContext
.getProperty(HTTPConstants.PROXY);
if (proxyProperties != null) {
String proxyHostProp = proxyProperties.getProxyHostName();
if (proxyHostProp == null || proxyHostProp.length() <= 0) {
throw new AxisFault("HTTP Proxy host is not available. Host is a MUST parameter");
} else {
proxyHost = proxyHostProp;
}
proxyPort = proxyProperties.getProxyPort();
// Overriding credentials
String userName = proxyProperties.getUserName();
String password = proxyProperties.getPassWord();
String domain = proxyProperties.getDomain();
if (userName != null && password != null && domain != null) {
proxyCredentials = new NTCredentials(userName, password, proxyHost, domain);
} else if (userName != null && domain == null) {
proxyCredentials = new UsernamePasswordCredentials(userName, password);
}
}