Created
November 1, 2010 14:39
-
-
Save jfarcand/658269 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void setCredentials(XmlRpcHttpClientConfig pConfig) throws XmlRpcClientException { | |
String userName = pConfig.getBasicUserName(); | |
if (userName != null) { | |
String enc = pConfig.getBasicEncoding(); | |
if (enc == null) { | |
enc = XmlRpcStreamConfig.UTF8_ENCODING; | |
} | |
client.getParams().setParameter(HttpMethodParams.CREDENTIAL_CHARSET, enc); | |
Credentials creds = new UsernamePasswordCredentials(userName, pConfig.getBasicPassword()); | |
AuthScope scope = new AuthScope(null, AuthScope.ANY_PORT, null, AuthScope.ANY_SCHEME); | |
client.getState().setCredentials(scope, creds); | |
client.getParams().setAuthenticationPreemptive(true); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment