本文整理汇总了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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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));
}