当前位置: 首页>>代码示例>>Java>>正文


Java XmlRpcClient.setTypeFactory方法代码示例

本文整理汇总了Java中org.apache.xmlrpc.client.XmlRpcClient.setTypeFactory方法的典型用法代码示例。如果您正苦于以下问题:Java XmlRpcClient.setTypeFactory方法的具体用法?Java XmlRpcClient.setTypeFactory怎么用?Java XmlRpcClient.setTypeFactory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.xmlrpc.client.XmlRpcClient的用法示例。


在下文中一共展示了XmlRpcClient.setTypeFactory方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: AnalysisRpcClient

import org.apache.xmlrpc.client.XmlRpcClient; //导入方法依赖的package包/类
/**
 * Create a new AnalysisRpc client that connects to a server on the given port
 *
 * @param port
 *          to connect to
 */
public AnalysisRpcClient(int port) {
  this.port = port;
  try {
    XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
    config.setServerURL(new URL("http://127.0.0.1:" + port + "/RPC2"));
    client = new XmlRpcClient();
    client.setConfig(config);
    client.setTypeFactory(new AnalysisRpcTypeFactoryImpl(client));
  } catch (MalformedURLException e) {
    // This is a programming error
    logger.error("Failed to create AnalysisRPCClient due to MalformedURLException", e);
  }
}
 
开发者ID:eclipse,项目名称:triquetrum,代码行数:20,代码来源:AnalysisRpcClient.java

示例2: connect

import org.apache.xmlrpc.client.XmlRpcClient; //导入方法依赖的package包/类
/**
 * Connect to remote Koji instance. Uses custom Transport factory adding a None / null support for XML-RPC.
 *
 * @param kojiInstanceURL Address of the remote Koji server.
 * @return XMLRPC client instance.
 */
private XmlRpcClient connect(String kojiInstanceURL) throws MalformedURLException {
    XmlRpcClient koji = new XmlRpcClient();
    koji.setTransportFactory(new XmlRpcCommonsTransportFactory(koji));
    XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
    koji.setTransportFactory(new XmlRpcCommonsTransportFactory(koji));
    koji.setTypeFactory(new MyTypeFactory(koji));
    config.setEnabledForExtensions(true);
    config.setEnabledForExceptions(true);

    try {
        config.setServerURL(new URL(kojiInstanceURL));
    } catch (MalformedURLException e) {
        throw e;
    }

    koji.setConfig(config);

    return koji;
}
 
开发者ID:vtunka,项目名称:jenkins-koji-plugin,代码行数:26,代码来源:KojiClient.java

示例3: initTransaction

import org.apache.xmlrpc.client.XmlRpcClient; //导入方法依赖的package包/类
private XmlRpcClient initTransaction() throws MalformedURLException
{
	XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
	// Authentification
	config.setBasicUserName(username);
	config.setBasicPassword(password);
	config.setServerURL(new URL(xmlRpcService));
	XmlRpcClient client = new XmlRpcClient();
	client.setConfig(config);
	client.setTypeFactory(new CustomTypeFactory(client));
	return client;
}
 
开发者ID:unistra,项目名称:fsp,代码行数:13,代码来源:XmlRpc.java

示例4: setupXmlClient

import org.apache.xmlrpc.client.XmlRpcClient; //导入方法依赖的package包/类
private XmlRpcClient setupXmlClient() {
    final XmlRpcClient client = new XmlRpcClient();

    URL url;
    try {
        /* TODO: should add SSL checking here! */
        String prot = "http";
        if (hostUseSsl) {
            prot = "https";
        }
        url = new URL(prot + "://" + hostIp + ":" + hostPort.toString());
        xmlClientConfig.setTimeZone(TimeZone.getTimeZone("UTC"));
        xmlClientConfig.setServerURL(url);
        /* disable, we use asyncexecute to control timeout */
        xmlClientConfig.setReplyTimeout(0);
        /* default to 60 secs */
        xmlClientConfig.setConnectionTimeout(60000);
        /* reply time is 5 mins */
        xmlClientConfig.setReplyTimeout(60 * 15000);
        if (hostUser != null && hostPass != null) {
            LOGGER.debug("Setting username " + hostUser);
            xmlClientConfig.setBasicUserName(hostUser);
            xmlClientConfig.setBasicPassword(hostPass);
        }
        xmlClientConfig.setXmlRpcServer(null);
        client.setConfig(xmlClientConfig);
        client.setTypeFactory(new RpcTypeFactory(client));
    } catch (MalformedURLException e) {
        LOGGER.info("Incorrect URL: ", e);
    }
    return client;
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:33,代码来源:Connection.java

示例5: callTimeoutInSec

import org.apache.xmlrpc.client.XmlRpcClient; //导入方法依赖的package包/类
@Override
public Object callTimeoutInSec(String method, List<?> params, int timeout,
        boolean debug) throws XmlRpcException {
    XmlRpcStreamConfig config = new XmlRpcHttpRequestConfigImpl();
    XmlRpcClient client = new XmlRpcClient();
    client.setTypeFactory(new RpcTypeFactory(client));
    XmlRpcResponseParser parser = new XmlRpcResponseParser(
            (XmlRpcStreamRequestConfig) config, client.getTypeFactory());
    XMLReader xr = SAXParsers.newXMLReader();
    xr.setContentHandler(parser);
    try {
        String result = null;
        if (getMethodResponse(method) != null) {
            result = getMethodResponse(method);
            LOGGER.debug("methodresponse call: " + method + " - " + params);
            LOGGER.trace("methodresponse reply: " + result);
        }
        if (result == null && multiRes.size() >= 0) {
            result = getResult();
            LOGGER.debug("getresult call: " + method + " - " + params);
            LOGGER.trace("getresult reply: " + result);
        }
        xr.parse(new InputSource(new StringReader(result)));
    } catch (Exception e) {
        throw new XmlRpcException("Exception: " + e.getMessage(), e);
    }
    if (parser.getErrorCode() != 0) {
        throw new XmlRpcException("Fault received[" + parser.getErrorCode()
                + "]: " + parser.getErrorMessage());
    }
    return parser.getResult();
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:33,代码来源:ConnectionTest.java

示例6: OpenSubtitlesAPI

import org.apache.xmlrpc.client.XmlRpcClient; //导入方法依赖的package包/类
/**
 * Constructor to create the XMLRpcClient and setup the needed configuration.
 * 
 * @throws MalformedURLException
 */
public OpenSubtitlesAPI() throws MalformedURLException {
	client = new XmlRpcClient();
	XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
	config.setServerURL(new URL(END_POINT));
	client.setConfig(config);
	client.setTypeFactory(new TypeFactory(client));
}
 
开发者ID:skimarxall,项目名称:asyncsubtitles,代码行数:13,代码来源:OpenSubtitlesAPI.java


注:本文中的org.apache.xmlrpc.client.XmlRpcClient.setTypeFactory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。