本文整理汇总了Java中org.apache.xmlrpc.server.XmlRpcServer.setHandlerMapping方法的典型用法代码示例。如果您正苦于以下问题:Java XmlRpcServer.setHandlerMapping方法的具体用法?Java XmlRpcServer.setHandlerMapping怎么用?Java XmlRpcServer.setHandlerMapping使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.xmlrpc.server.XmlRpcServer
的用法示例。
在下文中一共展示了XmlRpcServer.setHandlerMapping方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: PyUnitServer
import org.apache.xmlrpc.server.XmlRpcServer; //导入方法依赖的package包/类
/**
* As we need to be able to relaunch, we store the configuration and launch here (although the relaunch won't be
* actually done in this class, this is the place to get information on it).
*
* @param config used to get the configuration of the launch.
* @param launch the actual launch
* @throws IOException
*/
public PyUnitServer(PythonRunnerConfig config, ILaunch launch) throws IOException {
initializeDispatches();
port = SocketUtil.findUnusedLocalPorts(1)[0];
this.webServer = new WebServer(port);
XmlRpcServer serverToHandleRawInput = this.webServer.getXmlRpcServer();
serverToHandleRawInput.setHandlerMapping(new XmlRpcHandlerMapping() {
@Override
public XmlRpcHandler getHandler(String handlerName) throws XmlRpcNoSuchHandlerException, XmlRpcException {
return handler;
}
});
this.webServer.start();
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
launchManager.addLaunchListener(this.launchListener);
this.launch = launch;
this.configuration = config.getLaunchConfiguration();
}
示例2: start
import org.apache.xmlrpc.server.XmlRpcServer; //导入方法依赖的package包/类
@BeforeClass
public static void start() throws IOException, XmlRpcException {
webServer = new WebServer(0);
XmlRpcServer xmlRpcServer = webServer.getXmlRpcServer();
PropertyHandlerMapping phm = new PropertyHandlerMapping();
phm.addHandler("Loopback", LoopbackClass.class);
xmlRpcServer.setHandlerMapping(phm);
XmlRpcServerConfigImpl serverConfig = (XmlRpcServerConfigImpl) xmlRpcServer.getConfig();
serverConfig.setEnabledForExtensions(false);
serverConfig.setContentLengthOptional(false);
webServer.start();
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setServerURL(new URL("http://127.0.0.1:" + webServer.getPort() + "/xmlrpc"));
client = new XmlRpcClient();
client.setConfig(config);
}
示例3: server
import org.apache.xmlrpc.server.XmlRpcServer; //导入方法依赖的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);
}
示例4: startRpcServer
import org.apache.xmlrpc.server.XmlRpcServer; //导入方法依赖的package包/类
private void startRpcServer() {
try {
rpcServer = new WebServer(8000);
XmlRpcServer xmlRpcServer = rpcServer.getXmlRpcServer();
PropertyHandlerMapping mapper = new PropertyHandlerMapping();
mapper.addHandler("Signals", signals.getClass());
xmlRpcServer.setHandlerMapping(mapper);
rpcServer.start();
}
catch (Exception e) {
e.printStackTrace();
}
}
示例5: startServer
import org.apache.xmlrpc.server.XmlRpcServer; //导入方法依赖的package包/类
private Process startServer(int client_port, int port, boolean python) throws IOException {
File f = new File(TestDependent.TEST_PYDEV_PLUGIN_LOC + "pysrc/pydevconsole.py");
String[] cmdLine;
if (python) {
cmdLine = new String[] { TestDependent.PYTHON_EXE, "-u", FileUtils.getFileAbsolutePath(f), "" + port,
"" + client_port };
} else {
cmdLine = new String[] { TestDependent.JAVA_LOCATION, "-classpath", TestDependent.JYTHON_JAR_LOCATION,
"org.python.util.jython", FileUtils.getFileAbsolutePath(f), "" + port, "" + client_port };
}
Process process = Runtime.getRuntime().exec(cmdLine);
err = new ThreadStreamReader(process.getErrorStream());
out = new ThreadStreamReader(process.getInputStream());
err.start();
out.start();
this.webServer = new WebServer(client_port);
XmlRpcServer serverToHandleRawInput = this.webServer.getXmlRpcServer();
serverToHandleRawInput.setHandlerMapping(new XmlRpcHandlerMapping() {
@Override
public XmlRpcHandler getHandler(String handlerName) throws XmlRpcNoSuchHandlerException, XmlRpcException {
return new XmlRpcHandler() {
@Override
public Object execute(XmlRpcRequest request) throws XmlRpcException {
return "input_request";
}
};
}
});
this.webServer.start();
return process;
}
示例6: PydevConsoleCommunication
import org.apache.xmlrpc.server.XmlRpcServer; //导入方法依赖的package包/类
/**
* Initializes the xml-rpc communication.
*
* @param port the port where the communication should happen.
* @param process this is the process that was spawned (server for the XML-RPC)
*
* @throws MalformedURLException
*/
public PydevConsoleCommunication(int port, final Process process, int clientPort, String[] commandArray,
String[] envp, String encoding)
throws Exception {
this.commandArray = commandArray;
this.envp = envp;
finishedExecution = new ConditionEvent(new ICallback0<Boolean>() {
@Override
public Boolean call() {
try {
process.exitValue();
return true; // already exited
} catch (Exception e) {
return false;
}
}
}, 200);
//start the server that'll handle input requests
this.webServer = new WebServer(clientPort);
XmlRpcServer serverToHandleRawInput = this.webServer.getXmlRpcServer();
serverToHandleRawInput.setHandlerMapping(new XmlRpcHandlerMapping() {
@Override
public XmlRpcHandler getHandler(String handlerName) throws XmlRpcNoSuchHandlerException, XmlRpcException {
return PydevConsoleCommunication.this;
}
});
this.webServer.start();
this.stdStreamsThread = new StdStreamsThread(process, encoding);
this.stdStreamsThread.start();
IXmlRpcClient client = new ScriptXmlRpcClient(process);
client.setPort(port);
this.client = client;
}