本文整理汇总了Java中org.apache.xmlrpc.XmlRpcRequest类的典型用法代码示例。如果您正苦于以下问题:Java XmlRpcRequest类的具体用法?Java XmlRpcRequest怎么用?Java XmlRpcRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlRpcRequest类属于org.apache.xmlrpc包,在下文中一共展示了XmlRpcRequest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: sendRequest
import org.apache.xmlrpc.XmlRpcRequest; //导入依赖的package包/类
@Override
public Object sendRequest(XmlRpcRequest req) throws XmlRpcException {
XmlRpcHttpClientConfig config = (XmlRpcHttpClientConfig) req.getConfig();
URL serverUrl = config.getServerURL();
if (serverUrl == null) {
throw new XmlRpcException("Invalid server URL");
}
try {
con = openConnection(serverUrl);
con.setUseCaches(false);
con.setDoInput(true);
con.setDoOutput(true);
} catch (IOException e) {
throw new XmlRpcException("Failed to create URLConnection: " + e.getMessage(), e);
}
return super.sendRequest(req);
}
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:19,代码来源:AliasSupportedTransportFactory.java
示例2: createLegacyApi
import org.apache.xmlrpc.XmlRpcRequest; //导入依赖的package包/类
private JiraLegacyApi createLegacyApi() {
try {
XmlRpcClient client = new XmlRpcClient(getUrl());
Vector<String> parameters = new Vector<String>(Collections.singletonList(""));
XmlRpcRequest request = new XmlRpcRequest("jira1.getServerInfo", parameters);
@SuppressWarnings("unchecked") Hashtable<String, Object> response =
(Hashtable<String, Object>)client.execute(request, new CommonsXmlRpcTransport(new URL(getUrl()), getHttpClient()));
if (response != null) {
myJiraVersion = (String)response.get("version");
}
}
catch (Exception e) {
LOG.error("Cannot find out JIRA version via XML-RPC", e);
}
return new JiraLegacyApi(this);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:JiraRepository.java
示例3: createIssueViaXmlRpc
import org.apache.xmlrpc.XmlRpcRequest; //导入依赖的package包/类
@SuppressWarnings("UseOfObsoleteCollectionType")
@NotNull
private String createIssueViaXmlRpc(@NotNull String project, @NotNull String summary) throws Exception {
final URL url = new URL(myRepository.getUrl() + "/rpc/xmlrpc");
final XmlRpcClient xmlRpcClient = new XmlRpcClient(url);
final Map<String, Object> issue = new Hashtable<>();
issue.put("summary", summary);
issue.put("project", project);
issue.put("assignee", myRepository.getUsername());
issue.put("type", 1); // Bug
issue.put("state", 1); // Open
final Vector<Object> params = new Vector<>(Arrays.asList("", issue)); // empty token because of HTTP basic auth
final Hashtable result = (Hashtable)xmlRpcClient.execute(new XmlRpcRequest("jira1.createIssue", params),
new CommonsXmlRpcTransport(url, myRepository.getHttpClient()));
return (String)result.get("key");
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:JiraIntegrationTest.java
示例4: writeRequest
import org.apache.xmlrpc.XmlRpcRequest; //导入依赖的package包/类
public void writeRequest(XmlRpcStreamConfig config, XmlRpcRequest request) throws SAXException {
handler.startDocument();
boolean extensions = config.isEnabledForExtensions();
if (extensions) {
handler.startPrefixMapping("ex", org.apache.xmlrpc.serializer.XmlRpcWriter.EXTENSIONS_URI);
}
handler.startElement("", "methodCall", "methodCall", ZERO_ATTRIBUTES);
handler.startElement("", "methodName", "methodName", ZERO_ATTRIBUTES);
String s = request.getMethodName();
handler.characters(s.toCharArray(), 0, s.length());
handler.endElement("", "methodName", "methodName");
handler.startElement("", "params", "params", ZERO_ATTRIBUTES);
int num = request.getParameterCount();
for (int i = 0; i < num; i++) {
handler.startElement("", "param", "param", ZERO_ATTRIBUTES);
writeValue(request.getParameter(i));
handler.endElement("", "param", "param");
}
handler.endElement("", "params", "params");
handler.endElement("", "methodCall", "methodCall");
if (extensions) {
handler.endPrefixMapping("ex");
}
handler.endDocument();
}
开发者ID:HydAu,项目名称:Camel,代码行数:26,代码来源:XmlRpcWriter.java
示例5: getSelectedRepository
import org.apache.xmlrpc.XmlRpcRequest; //导入依赖的package包/类
private List<Object> getSelectedRepository() throws IOException, XmlRpcException, RepositoryException {
if (selectedRepository == null) {
@SuppressWarnings("unchecked")
List<List<Object>> repoList = (List<List<Object>>) getXmlRpcClient()
.execute(new XmlRpcRequest(handler + ".getAllSpecificationRepositories", toArgs()));
for (List<Object> repo : repoList) {
if (StringUtils.equals(CONFLUENCE + getRepositoryName(), (String) repo.get(REPOSITORY_UID_INDEX))){
selectedRepository = repo;
break;
}
}
if (selectedRepository == null) {
throw new RepositoryException(format("SpecificationRepository %s not found", getRepositoryName()));
}
}
return selectedRepository;
}
开发者ID:strator-dev,项目名称:greenpepper,代码行数:18,代码来源:AtlassianRepository.java
示例6: execute
import org.apache.xmlrpc.XmlRpcRequest; //导入依赖的package包/类
/**
* Called when the server is requesting some input from this class.
*/
@Override
public Object execute(XmlRpcRequest request) throws XmlRpcException {
String methodName = request.getMethodName();
if ("RequestInput".equals(methodName)) {
return requestInput();
} else if ("IPythonEditor".equals(methodName)) {
return openEditor(request);
} else if ("NotifyAboutMagic".equals(methodName)) {
return "";
} else if ("NotifyFinished".equals(methodName)) {
finishedExecution.set();
return "";
}
Log.log("Unexpected call to execute for method name: " + methodName);
return "";
}
开发者ID:fabioz,项目名称:Pydev,代码行数:20,代码来源:PydevConsoleCommunication.java
示例7: execute
import org.apache.xmlrpc.XmlRpcRequest; //导入依赖的package包/类
@Override
public Object execute(final XmlRpcRequest request) throws XmlRpcException {
return execute(new IRequest() {
@Override
public int getParameterCount() {
return request.getParameterCount();
}
@Override
public Object getParameter(int i) {
return request.getParameter(i);
}
@Override
public String getMethodName() {
return request.getMethodName();
}
});
}
开发者ID:fabioz,项目名称:Pydev,代码行数:21,代码来源:PyUnitServer.java
示例8: marshal
import org.apache.xmlrpc.XmlRpcRequest; //导入依赖的package包/类
@Override
public void marshal(Exchange exchange, Object graph, OutputStream stream) throws Exception {
// need to check the object type
XMLWriter control = getXMLWriter(exchange, stream);
XmlRpcWriter writer = new XmlRpcWriter(xmlRpcStreamRequestConfig, control, typeFactory);
if (graph instanceof XmlRpcRequest) {
writer.writeRequest(xmlRpcStreamRequestConfig, (XmlRpcRequest)graph);
} else {
// write the result here directly
// TODO write the fault message here
writer.write(xmlRpcStreamRequestConfig, graph);
}
}
开发者ID:HydAu,项目名称:Camel,代码行数:14,代码来源:XmlRpcDataFormat.java
示例9: toXmlRpcRequest
import org.apache.xmlrpc.XmlRpcRequest; //导入依赖的package包/类
@Converter
public static XmlRpcRequest toXmlRpcRequest(final Object[] parameters, Exchange exchange) {
// get the message operation name
String operationName = exchange.getIn().getHeader(XmlRpcConstants.METHOD_NAME, String.class);
// create the request object here
XmlRpcRequest request = new XmlRpcRequestImpl(operationName, parameters);
return request;
}
开发者ID:HydAu,项目名称:Camel,代码行数:11,代码来源:XmlRpcConverter.java
示例10: handleResult
import org.apache.xmlrpc.XmlRpcRequest; //导入依赖的package包/类
@Override
public void handleResult(XmlRpcRequest pRequest, Object pResult) {
LOG.trace("Get the response {}", pResult);
camelExchange.getOut().setHeaders(camelExchange.getIn().getHeaders());
camelExchange.getOut().setBody(pResult);
camelAsyncCallback.done(false);
}
开发者ID:HydAu,项目名称:Camel,代码行数:8,代码来源:XmlRpcAsyncCallback.java
示例11: testRequestMessage
import org.apache.xmlrpc.XmlRpcRequest; //导入依赖的package包/类
@Test
public void testRequestMessage() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:request");
mock.expectedMessageCount(1);
XmlRpcRequest result = template.requestBody("direct:request", new XmlRpcRequestImpl("greet", new Object[]{"you", 2}), XmlRpcRequest.class);
assertNotNull(result);
assertEquals("Get a wrong request operation name", "greet", result.getMethodName());
assertEquals("Get a wrong request parameter size", 2, result.getParameterCount());
assertEquals("Get a wrong request parameter", 2, result.getParameter(1));
assertMockEndpointsSatisfied();
}
开发者ID:HydAu,项目名称:Camel,代码行数:13,代码来源:SpringXmlRpcDataFormatTest.java
示例12: testToXmlRpcRequest
import org.apache.xmlrpc.XmlRpcRequest; //导入依赖的package包/类
@Test
public void testToXmlRpcRequest() throws Exception {
CamelContext context = new DefaultCamelContext();
Exchange exchange = new DefaultExchange(context);
exchange.getIn().setHeader(XmlRpcConstants.METHOD_NAME, "greet");
exchange.getIn().setBody(new Object[] {"me", "you"});
XmlRpcRequest request = exchange.getIn().getBody(XmlRpcRequest.class);
assertNotNull("The request should not be null", request);
assertEquals("Get a wrong operation name", "greet", request.getMethodName());
assertEquals("Get a wrong parameter size", 2, request.getParameterCount());
assertEquals("Get a worng parameter", "you", request.getParameter(1));
}
开发者ID:HydAu,项目名称:Camel,代码行数:14,代码来源:XmlRpcConverterTest.java
示例13: testToXmlRpcRequestWithoutOperationName
import org.apache.xmlrpc.XmlRpcRequest; //导入依赖的package包/类
@Test(expected = TypeConversionException.class)
public void testToXmlRpcRequestWithoutOperationName() throws Exception {
CamelContext context = new DefaultCamelContext();
Exchange exchange = new DefaultExchange(context);
exchange.getIn().setBody(new Object[] {"me", "you"});
exchange.getIn().getBody(XmlRpcRequest.class);
fail("Expect the exception is throw");
}
开发者ID:HydAu,项目名称:Camel,代码行数:11,代码来源:XmlRpcConverterTest.java
示例14: sendRequest
import org.apache.xmlrpc.XmlRpcRequest; //导入依赖的package包/类
public Object sendRequest(XmlRpcRequest pRequest) throws XmlRpcException {
config = (XmlRpcHttpClientConfig) pRequest.getConfig();
URL url = config.getServerURL();
ssl = "https".equals(url.getProtocol());
hostname = url.getHost();
int p = url.getPort();
port = p < 1 ? 80 : p;
String u = url.getFile();
uri = (u == null || "".equals(u)) ? "/" : u;
host = port == 80 ? hostname : hostname + ":" + port;
headers.put("Host", host);
return super.sendRequest(pRequest);
}
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:14,代码来源:OrchidXmlRpcTransport.java
示例15: setDocumentAsImplemeted
import org.apache.xmlrpc.XmlRpcRequest; //导入依赖的package包/类
/** {@inheritDoc} */
public void setDocumentAsImplemeted(String location) throws Exception
{
Vector<?> args = CollectionUtil.toVector( username , password, args(URI.create(URIUtil.raw(location))));
XmlRpcClient xmlrpc = getXmlRpcClient();
String msg = (String)xmlrpc.execute( new XmlRpcRequest( handler + ".setSpecificationAsImplemented", args ) );
if(!("<success>".equals(msg))) throw new Exception(msg);
}
开发者ID:strator-dev,项目名称:greenpepper,代码行数:10,代码来源:AtlassianRepository.java
示例16: getSpecificationsHierarchy
import org.apache.xmlrpc.XmlRpcRequest; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public DocumentNode getSpecificationsHierarchy(String project, String systemUnderTest) throws Exception {
if (isAnyEmpty(project, systemUnderTest)) {
LOGGER.warn("The 'projectName' or the 'systemUnderTest' is empty. We will not be able to list the server's specifications.");
return new DocumentNode("EMPTY");
}
XmlRpcClient xmlrpc = getXmlRpcClient();
@SuppressWarnings("unchecked")
List<List<Object>> sutList = (List<List<Object>>) xmlrpc.execute(new XmlRpcRequest(handler + ".getSystemUnderTestsOfProject", toArgs(project)));
List<Object> selectedSUT = null;
for (List<Object> sut : sutList) {
String SutName = (String)sut.get(SUTNAME_INDEX);
if (StringUtils.equals(SutName, systemUnderTest)) {
selectedSUT = sut;
break;
}
}
if (selectedSUT == null) {
throw new RepositoryException(format("SUT %s not found in the project %s", systemUnderTest, project));
}
List<Object> list = (List<Object>) xmlrpc.execute(
new XmlRpcRequest(handler + ".getSpecificationHierarchy", toArgs(getSelectedRepository(), selectedSUT)));
return DocumentNode.toDocumentNode(list);
}
开发者ID:strator-dev,项目名称:greenpepper,代码行数:31,代码来源:AtlassianRepository.java
示例17: listDocumentsInHierarchy
import org.apache.xmlrpc.XmlRpcRequest; //导入依赖的package包/类
/**
* <p>listDocumentsInHierarchy.</p>
*
* @return a {@link java.util.List} object.
* @throws java.lang.Exception if any.
*/
@SuppressWarnings("unchecked")
public List<Object> listDocumentsInHierarchy() throws Exception
{
Vector<?> args = CollectionUtil.toVector( username , password, CollectionUtil.toVector(getRepositoryName()));
XmlRpcClient xmlrpc = getXmlRpcClient();
return (Vector<Object>)xmlrpc.execute( new XmlRpcRequest( handler + ".getSpecificationHierarchy", args ) );
}
开发者ID:strator-dev,项目名称:greenpepper,代码行数:14,代码来源:AtlassianRepository.java
示例18: downloadSpecificationsDefinitions
import org.apache.xmlrpc.XmlRpcRequest; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private Vector<Vector<String>> downloadSpecificationsDefinitions(String repoUID) throws Exception
{
Vector<Vector<String>> definitions = (Vector<Vector<String>>) getXmlRpcClient().execute(
new XmlRpcRequest( handler + ".getListOfSpecificationLocations", CollectionUtil.toVector(repoUID, sut)) );
checkForErrors(definitions);
return definitions;
}
开发者ID:strator-dev,项目名称:greenpepper,代码行数:9,代码来源:GreenPepperRepository.java
示例19: initHttpHeaders
import org.apache.xmlrpc.XmlRpcRequest; //导入依赖的package包/类
@Override
protected void initHttpHeaders(final XmlRpcRequest pRequest) throws XmlRpcClientException {
super.initHttpHeaders(pRequest);
XmlRpcHttpClientConfig config = (XmlRpcHttpClientConfig) pRequest.getConfig();
URI requestUri;
try {
requestUri = config.getServerURL().toURI();
} catch (URISyntaxException e) {
throw new XmlRpcClientException(e.getMessage(), e);
}
setRequestHeader("Cookie", cookieFileStore.toCookieRequestText(requestUri.getHost(), false));
}
开发者ID:vmware,项目名称:workflowTools,代码行数:13,代码来源:BugzXmlRpcTransport.java
示例20: server
import org.apache.xmlrpc.XmlRpcRequest; //导入依赖的package包/类
private static void server() throws IOException, XmlRpcException {
WebServer webServer = new WebServer(8089);
XmlRpcServer xmlRpcServer = webServer.getXmlRpcServer();
PropertyHandlerMapping mapping = new PropertyHandlerMapping();
mapping.addHandler(POWRemoteAPI.class.getName(), POWServerAPI.class);
POWRemoteAPI api = (POWRemoteAPI) Util.newInstance(POWServerAPI.class);
mapping.setRequestProcessorFactoryFactory(
new RequestProcessorFactoryFactory.RequestSpecificProcessorFactoryFactory() {
@Override
protected Object getRequestProcessor(Class pClass, XmlRpcRequest pRequest) throws XmlRpcException {
return api;
}
});
xmlRpcServer.setHandlerMapping(mapping);
XmlRpcServerConfigImpl serverConfig
= (XmlRpcServerConfigImpl) xmlRpcServer.getConfig();
serverConfig.setEnabledForExtensions(true);
serverConfig.setContentLengthOptional(false);
webServer.start();
api.blinkStatusLED(500, 500);
}
开发者ID:miho,项目名称:PiOnWheels,代码行数:31,代码来源:Main.java
注:本文中的org.apache.xmlrpc.XmlRpcRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论