本文整理匯總了Java中org.apache.xmlrpc.client.XmlRpcClientConfigImpl.setServerURL方法的典型用法代碼示例。如果您正苦於以下問題:Java XmlRpcClientConfigImpl.setServerURL方法的具體用法?Java XmlRpcClientConfigImpl.setServerURL怎麽用?Java XmlRpcClientConfigImpl.setServerURL使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.xmlrpc.client.XmlRpcClientConfigImpl
的用法示例。
在下文中一共展示了XmlRpcClientConfigImpl.setServerURL方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: registerUser
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl; //導入方法依賴的package包/類
public boolean registerUser(String user, String password) throws Exception {
XmlRpcClientConfigImpl xmlConfig = new XmlRpcClientConfigImpl();
xmlConfig.setServerURL(new URL(config.getProperty(SYSTEM_XMPP_BACKEND_SERVER_URL)));
XmlRpcClient client = new XmlRpcClient();
client.setConfig(xmlConfig);
Map<String, Object> params = new HashMap<>();
params.put(USER, user);
params.put(PASSWORD, password);
params.put(SERVER, config.getProperty(SYSTEM_XMPP_DOMAIN));
List<Object> register_params = new ArrayList<>();
register_params.add(params);
Object result = client.execute(CREATE_ACCOUNT, register_params);
return true;
}
示例2: getRpcClient
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl; //導入方法依賴的package包/類
public org.apache.xmlrpc.client.XmlRpcClient getRpcClient(String url, String login, String password) throws MalformedURLException {
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setServerURL(new URL(url));
if (login != null) {
config.setBasicUserName(login);
}
if (password != null) {
config.setBasicPassword(password);
}
if (keyStoreComponent != null && keyStoreName != null && keyAlias != null) {
return new XmlRpcClient(config, keyStoreComponent, keyStoreName, keyAlias);
} else {
return new XmlRpcClient(config);
}
}
示例3: CookieAwareXmlRpcClient
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl; //導入方法依賴的package包/類
public CookieAwareXmlRpcClient(String url) {
super();
try {
this.apiURL = new URL(url);
} catch (MalformedURLException e) {
throw new RuntimeIOException(e);
}
String homeFolder = System.getProperty("user.home");
cookieFileStore = new CookieFileStore(homeFolder);
workflowCertificateManager = new WorkflowCertificateManager(homeFolder + "/.workflowTool.keystore");
final XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setServerURL(apiURL);
final XmlRpcCommonsTransportFactory factory = new XmlRpcCookiesTransportFactory(this, cookieFileStore);
this.setTransportFactory(factory);
this.setTypeFactory(new TolerantTypeFactory(this));
this.setConfig(config);
}
示例4: createXmlRpcClient
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl; //導入方法依賴的package包/類
private XmlRpcClient createXmlRpcClient() {
// create client configuration
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
try {
config.setServerURL(new URL(url));
} catch (MalformedURLException e) {
e.printStackTrace();
Starter.die("could not parse URL");
}
config.setBasicUserName(username);
config.setBasicPassword(password);
// ignore self-signed certificate errors
if (url.startsWith("https")) {
disableCertCheck();
}
XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);
return client;
}
示例5: testConnection
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl; //導入方法依賴的package包/類
private static boolean testConnection(DemoDbInfo infos) {
// Try to connect to that DB to check it is still available
final XmlRpcClient client = new XmlRpcClient();
final XmlRpcClientConfigImpl common_config = new XmlRpcClientConfigImpl();
try {
String protocolAsString = infos.protocol == RPCProtocol.RPC_HTTP ? "http://" : "https://";
common_config.setServerURL(
new URL(String.format("%s%s:%s/xmlrpc/2/common", protocolAsString, infos.host, infos.port)));
int uid = (int) client.execute(common_config, "authenticate",
new Object[] { infos.db, infos.username, infos.password, new Object[] {} });
// Informations are valid if user could log in.
return uid != 0;
} catch (MalformedURLException e1) {
// Previously saved data is causing this...
// We will have to request a new demo db
return false;
} catch (XmlRpcException e) {
// Connection to previous demo db failed somehow, we will have
// to request a new one...
return false;
}
}
示例6: initializeClient
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl; //導入方法依賴的package包/類
/**
* Set up the configuration
*
* @return
* @throws MalformedURLException
*/
private XmlRpcClient initializeClient() {
// Get the RPC client set up and ready to go
// The alternate TransportFactory stuff is required so that cookies
// work and the logins behave persistently
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
try {
config.setServerURL(new URL(this.getServerURLWithRpc()));
} catch (MalformedURLException e) {
e.printStackTrace();
}
// config.setEnabledForExtensions(true);
XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);
XmlRpcCommonsTransportFactory factory = new XmlRpcCommonsTransportFactory(client);
factory.setHttpClient(new HttpClient());
client.setTransportFactory(factory);
return client;
}
示例7: initializeRPC
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl; //導入方法依賴的package包/類
public void initializeRPC() {
try {
XmlRpcClientConfigImpl configuration = new XmlRpcClientConfigImpl();
configuration.setServerURL(new URL("http://"+variables.get("host")+
":"+variables.get("centralengineport")));
configuration.setBasicPassword(variables.get("password"));
configuration.setBasicUserName(variables.get("user"));
client = new XmlRpcClient();
client.setConfig(configuration);
System.out.println("Client initialized: " + client);
} catch (Exception e) {
if(variables!=null &&
variables.get("host")!=null &&
variables.get("centralengineport")!=null){
System.out.println("Could not conect to " + variables.get("host")
+ variables.get("centralengineport"));
} else {
System.out.println("Could not connect and initialize RPC connection to server."+
"Configuration variables might not be properly set.");
}
}
}
示例8: main
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setEnabledForExtensions(true);
config.setServerURL(new URL("http://127.0.0.1:" + Constants.XMLRPC_PORT));
XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);
Object[] params = new Object[] { Constants.USER, Constants.REQUESTID, "887611628764801051", "2"};
// strFileId, strVersion
long startTotal = System.currentTimeMillis();
String strResponse = (String) client.execute("XmlRpcSyncHandler.restoreMetadata", params);
System.out.println("Response --> " + Constants.PrettyPrintJson(strResponse));
long totalTime = System.currentTimeMillis() - startTotal;
System.out.println("Total level time --> " + totalTime + " ms");
}
示例9: main
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setEnabledForExtensions(true);
config.setServerURL(new URL("http://127.0.0.1:" + Constants.XMLRPC_PORT));
XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);
Object[] params = new Object[] { Constants.USER, Constants.REQUESTID, "hola5", null};
// strFolderName, strParentId
long startTotal = System.currentTimeMillis();
String strResponse = (String) client.execute("XmlRpcSyncHandler.putMetadataFolder", params);
System.out.println("Response --> " + Constants.PrettyPrintJson(strResponse));
long totalTime = System.currentTimeMillis() - startTotal;
System.out.println("Total level time --> " + totalTime + " ms");
}
示例10: main
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setEnabledForExtensions(true);
config.setServerURL(new URL("http://127.0.0.1:" + Constants.XMLRPC_PORT));
XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);
Object[] params = new Object[] { Constants.USER, Constants.REQUESTID, "887611628764801051" };
// strFileId
long startTotal = System.currentTimeMillis();
String strResponse = (String) client.execute("XmlRpcSyncHandler.getVersions", params);
System.out.println("Response --> " + Constants.PrettyPrintJson(strResponse));
long totalTime = System.currentTimeMillis() - startTotal;
System.out.println("Total level time --> " + totalTime + " ms");
}
示例11: executeTests
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl; //導入方法依賴的package包/類
public static Object executeTests(String server, Map<String, String> map) {
Object result = null;
try{
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setServerURL(new URL(server));
XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);
result = client.execute("executeTestCase", new Object[] {map});
}
catch ( Exception ex ) {
ex.printStackTrace();
}
return result;
}
示例12: buildConfig
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl; //導入方法依賴的package包/類
/**
* Builds XmlRpcClientConfig from {@link eionet.webq.dto.CdrRequest}.
*
* @param parameters parameters
* @return config
*/
private XmlRpcClientConfig buildConfig(CdrRequest parameters) {
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setServerURL(createUrlFromString(parameters.getEnvelopeUrl()));
if (parameters.isAuthorizationSet()) {
if (StringUtils.isNotEmpty(parameters.getUserName())) {
config.setBasicUserName(parameters.getUserName());
config.setBasicPassword(parameters.getPassword());
} else {
KnownHost knownHost = knownHostsService.getKnownHost(parameters.getEnvelopeUrl());
if (knownHost != null) {
config.setBasicUserName(knownHost.getKey());
config.setBasicPassword(knownHost.getTicket());
}
}
}
return config;
}
示例13: login
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl; //導入方法依賴的package包/類
/**
* login
*/
public SatelliteConnection login() {
if (logger == null) {
logger = new PrintStream(System.out);
}
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setServerURL(configuration.getRpcUrl());
config.setEnabledForExtensions(true);
if (configuration.isSSL()) {
initializeSSLContext();
}
client = new XmlRpcClient();
client.setConfig(config);
auth = call("auth.login", configuration.getUser(), configuration.getPassword());
return this;
}
示例14: initializeRPC
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl; //導入方法依賴的package包/類
public void initializeRPC() {
try {
XmlRpcClientConfigImpl configuration = new XmlRpcClientConfigImpl();
configuration.setServerURL(new URL("http://"
+ variables.get("host") + ":"
+ variables.get("centralengineport")));
configuration.setBasicPassword(variables.get("password"));
configuration.setBasicUserName(variables.get("user"));
client = new XmlRpcClient();
client.setConfig(configuration);
System.out.println("Client initialized: " + client);
} catch (Exception e) {
System.out.println("Could not conect to " + variables.get("host")
+ " :" + variables.get("centralengineport")
+ "for RPC client initialization");
}
}
示例15: initBlogClient
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl; //導入方法依賴的package包/類
private void initBlogClient() {
if (this.blogUrl != null) {
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setServerURL(this.blogUrl);
config.setEncoding("UTF-8");
config.setBasicEncoding("UTF-8");
this.blogClient = new XmlRpcClient();
blogClient.setConfig(config);
}
}