- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.apache.xmlrpc.webserver.WebServer
类的一些代码示例,展示了WebServer
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebServer
类的具体详情如下:
包路径:org.apache.xmlrpc.webserver.WebServer
类名称:WebServer
[英]The WebServer is a minimal HTTP server, that might be used as an embedded web server.
Use of the WebServer has grown very popular amongst users of Apache XML-RPC. Why this is the case, can hardly be explained, because the WebServer is at best a workaround, compared to full blown servlet engines like Tomcat or Jetty. For example, under heavy load it will almost definitely be slower than a real servlet engine, because it does neither support proper keepalive (multiple requests per physical connection) nor chunked mode (in other words, it cannot stream requests).
If you still insist in using the WebServer, it is recommended to use its subclass, the ServletWebServer instead, which offers a minimal subset of the servlet API. In other words, you keep yourself the option to migrate to a real servlet engine later.
Use of the WebServer goes roughly like this: First of all, create a property file (for example "MyHandlers.properties") and add it to your jar file. The property keys are handler names and the property values are the handler classes. Once that is done, create an instance of WebServer:
final int port = 8088;
final String propertyFile = "MyHandler.properties";
PropertyHandlerMapping mapping = new PropertyHandlerMapping();
ClassLoader cl = Thread.currentThread().getContextClassLoader();
mapping.load(cl, propertyFile);
WebServer webServer = new WebServer(port);
XmlRpcServerConfigImpl config = new XmlRpcServerConfigImpl();
XmlRpcServer server = webServer.getXmlRpcServer();
server.setConfig(config);
server.setHandlerMapping(mapping);
webServer.start();
[中]WebServer是一个最小的HTTP服务器,可以用作嵌入式web服务器。
Web服务器的使用在Apache XML-RPC用户中变得非常流行。很难解释为什么会出现这种情况,因为与Tomcat或Jetty等成熟的servlet引擎相比,Web服务器充其量只是一种变通方法。例如,在重载情况下,它几乎肯定会比真正的servlet引擎慢,因为它既不支持正确的keepalive(每个物理连接有多个请求),也不支持分块模式(换句话说,它不能流式处理请求)。
如果仍然坚持使用WebServer,建议使用它的子类ServletWebServer,它提供了ServletAPI的最小子集。换句话说,您可以选择以后迁移到真正的servlet引擎。
Web服务器的使用大致如下:首先,创建一个属性文件(例如“MyHandlers.properties”),并将其添加到jar文件中。属性键是处理程序名称,属性值是处理程序类。完成后,创建一个WebServer实例:
final int port = 8088;
final String propertyFile = "MyHandler.properties";
PropertyHandlerMapping mapping = new PropertyHandlerMapping();
ClassLoader cl = Thread.currentThread().getContextClassLoader();
mapping.load(cl, propertyFile);
WebServer webServer = new WebServer(port);
XmlRpcServerConfigImpl config = new XmlRpcServerConfigImpl();
XmlRpcServer server = webServer.getXmlRpcServer();
server.setConfig(config);
server.setHandlerMapping(mapping);
webServer.start();
代码示例来源:origin: org.nuiton.topia/topia-soa
/**
* Constructeur.
*
* Initialise le serveur.
*
* @param port port de lancement du serveur
*/
public XMLRPCServer(int port) {
webServer = new WebServer(port);
XmlRpcServer xmlRpcServer = webServer.getXmlRpcServer();
xmlRpcServer.setHandlerMapping(this);
}
代码示例来源:origin: org.nuiton.topia/topia-soa
/**
* lance le serveur
*/
public void launch() {
if (!alreadyLaunched) {
try {
webServer.start();
logger.info("XML-RPC server running...");
} catch (IOException e) {
logger.debug("I/O erreur while launching xml-rpc web serveur",
e);
}
alreadyLaunched = true;
}
}
代码示例来源:origin: org.apache.xmlrpc/xmlrpc-server
/**
* Spawns a new thread which binds this server to the port it's
* configured to accept connections on.
*
* @see #run()
* @throws IOException Binding the server socket failed.
*/
public void start() throws IOException {
setupServerSocket(50);
// The listener reference is released upon shutdown().
if (listener == null) {
listener = new Thread(this, "XML-RPC Weblistener");
// Not marked as daemon thread since run directly via main().
listener.start();
}
}
代码示例来源:origin: edu.illinois.cs.cogcomp/DatalessClassification
public static void server(String indexDirectory, int port)
throws IOException, XmlRpcException {
log.info(
"Starting descartes server at port {}, with index directory {}",
Integer.valueOf(port), indexDirectory);
DescartesServer.indexDirectory = indexDirectory;
WebServer webServer = new WebServer(port);
XmlRpcServer xmlRpcServer = webServer.getXmlRpcServer();
PropertyHandlerMapping phm = new PropertyHandlerMapping();
phm.addHandler("DescartesServer", DescartesServer.class);
xmlRpcServer.setHandlerMapping(phm);
XmlRpcServerConfigImpl serverConfig = (XmlRpcServerConfigImpl) xmlRpcServer
.getConfig();
serverConfig.setEnabledForExtensions(true);
serverConfig.setContentLengthOptional(false);
webServer.start();
log.info("Descartes is ready!");
}
代码示例来源:origin: rosjava/rosjava_core
pool = newThreadPool();
try {
while (listener != null) {
socket.setTcpNoDelay(true);
} catch (SocketException socketOptEx) {
log(socketOptEx);
if (allowConnection(socket)) {
final ThreadPool.Task task = newTask(this, server, socket);
if (pool.startTask(task)) {
socket = null;
} else {
log("Maximum load of " + pool.getMaxThreads()
+ " exceeded, rejecting client");
log(t);
serverSocket.close();
} catch (IOException e) {
log(e);
代码示例来源:origin: rosjava/rosjava_core
org.apache.xmlrpc.server.XmlRpcServer xmlRpcServer = server.getXmlRpcServer();
PropertyHandlerMapping phm = new PropertyHandlerMapping();
phm.setRequestProcessorFactoryFactory(new NodeRequestProcessorFactoryFactory<T>(instance));
serverConfig.setContentLengthOptional(false);
try {
server.start();
} catch (IOException e) {
throw new RosRuntimeException(e);
代码示例来源:origin: rosjava/rosjava_core
public XmlRpcServer(BindAddress bindAddress, AdvertiseAddress advertiseAddress) {
InetSocketAddress address = bindAddress.toInetSocketAddress();
server = new WebServer(address.getPort(), address.getAddress());
this.advertiseAddress = advertiseAddress;
this.advertiseAddress.setPortCallable(new Callable<Integer>() {
@Override
public Integer call() throws Exception {
return server.getPort();
}
});
startLatch = new CountDownLatch(1);
}
代码示例来源:origin: rosjava/rosjava_core
webServer.log(e.getClass().getName() + ": " + e.getMessage());
try {
writeErrorHeader(e.requestData, e, -1);
webServer.log(t);
代码示例来源:origin: org.apache.xmlrpc/xmlrpc-server
serverSocket = createServerSocket(port, backlog, address);
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-entity-similarity
public static void main(String[] args) {
if (args.length != 1)
System.err.println("Usage: ECServer port");
int port = (new Integer(args[0])).intValue();
try {
System.out.println("Attempting to start XML-RPC Server...");
WebServer server = new WebServer(port);
XmlRpcServer xmlRpcServer = server.getXmlRpcServer();
PropertyHandlerMapping phm = new PropertyHandlerMapping();
phm.addHandler("EntityComparison", EntityComparison.class);
xmlRpcServer.setHandlerMapping(phm);
XmlRpcServerConfigImpl serverConfig = (XmlRpcServerConfigImpl)xmlRpcServer.getConfig();
serverConfig.setEnabledForExtensions(true);
serverConfig.setContentLengthOptional(false);
server.start();
System.out.println("Started successfully.");
System.out.println("Accepting requests. (Halt program to stop.)");
}
catch (Exception exception) {
System.err.println("ECServer: " + exception);
}
}
}
代码示例来源:origin: org.apache.xmlrpc/xmlrpc-server
pool = newThreadPool();
try {
while (listener != null) {
socket.setTcpNoDelay(true);
} catch (SocketException socketOptEx) {
log(socketOptEx);
if (allowConnection(socket)) {
final ThreadPool.Task task = newTask(this, server, socket);
if (pool.startTask(task)) {
socket = null;
} else {
log("Maximum load of " + pool.getMaxThreads()
+ " exceeded, rejecting client");
log(t);
serverSocket.close();
} catch (IOException e) {
log(e);
代码示例来源:origin: org.apache.xmlrpc/xmlrpc-server
webServer.log(e.getClass().getName() + ": " + e.getMessage());
try {
writeErrorHeader(e.requestData, e, -1);
webServer.log(t);
代码示例来源:origin: org.sonatype.sisu/sisu-xmlrpc-server
serverSocket = createServerSocket(port, backlog, address);
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-wnsim
WebServer server = new WebServer( port );
XmlRpcServer xmlRpcServer = server.getXmlRpcServer();
serverConfig.setContentLengthOptional(false);
server.start();
代码示例来源:origin: org.sonatype.sisu/sisu-xmlrpc-server
pool = newThreadPool();
try {
while (listener != null) {
socket.setTcpNoDelay(true);
} catch (SocketException socketOptEx) {
log(socketOptEx);
if (allowConnection(socket)) {
final ThreadPool.Task task = newTask(this, server, socket);
if (pool.startTask(task)) {
socket = null;
} else {
log("Maximum load of " + pool.getMaxThreads()
+ " exceeded, rejecting client");
log(t);
serverSocket.close();
} catch (IOException e) {
log(e);
代码示例来源:origin: org.sonatype.sisu/sisu-xmlrpc-server
/**
* Spawns a new thread which binds this server to the port it's
* configured to accept connections on.
*
* @see #run()
* @throws IOException Binding the server socket failed.
*/
public void start() throws IOException {
setupServerSocket(50);
// The listener reference is released upon shutdown().
if (listener == null) {
listener = new Thread(this, "XML-RPC Weblistener");
// Not marked as daemon thread since run directly via main().
listener.start();
}
}
代码示例来源:origin: org.sonatype.sisu/sisu-xmlrpc-server
webServer.log(e.getClass().getName() + ": " + e.getMessage());
try {
writeErrorHeader(e.requestData, e, -1);
webServer.log(t);
代码示例来源:origin: rosjava/rosjava_core
serverSocket = createServerSocket(port, backlog, address);
代码示例来源:origin: rosjava/rosjava_core
/**
* Spawns a new thread which binds this server to the port it's
* configured to accept connections on.
*
* @see #run()
* @throws IOException Binding the server socket failed.
*/
public void start() throws IOException {
setupServerSocket(50);
// The listener reference is released upon shutdown().
if (listener == null) {
listener = new Thread(this, "XML-RPC Weblistener");
// Not marked as daemon thread since run directly via main().
listener.start();
}
}
服务器代码(基于 Python 库引用): from xmlrpc.server import SimpleXMLRPCServer from xmlrpc.server import SimpleX
有什么方法可以同时从一个 xmlrpc 客户端向不同的 xmlrpc 服务器发出多个调用。 我的服务器代码如下所示:(我将让这段代码在两台机器上运行,server1 和 server2) class
我在我的 Apache 服务器上安装了 xmlrpc-epi,我需要使用它来连接到 XMLRPC 服务器。我应该做什么 - 除了 xmlprc-api 之外,我还需要在我的服务器上下载和/或安装什么吗
我正在构建一个使用wordpress-java库的android应用,但出现了"Failed to resolve: redstone.xmlrpc:xmlrpc:1.1.1"错误。 Build.Gr
实际上需要传递一个参数,该参数是一个xml作为带有xmlrpc Node 模块的对象github.com/baalexander/node-xmlrpc; 客户端调用是: client.methodC
我有一个运行 Python 的 XML RPC 服务器。 它作为 SimpleXMLRPCServer 类的实例实现。 from SimpleXMLRPCServer import SimpleXML
我不会从表格中读取行来将主题放在列表中 php脚本 $url_obj='http://'.$host.':8069/xmlrpc/object'; $sock=new xmlrpc_client($u
如何将脚本执行错误传递给 XMLRPC 响应,以免出现故障异常? 也许我没有正确设置: 在 XMLRPC 服务器中,我添加了 Zend_XmlRpc_Server_Fault::attachFault
有关如何使用 XMLRPC 实现基本身份验证的任何线索或示例org.apache.xmlrpc.webserver.WebServer? 我正在使用 Java API apache-xmlrpc-3.
我有一个使用 GHC 运行的 Haskell RPCXML (HaXR) 服务器进程,它需要执行它传递的任何函数。这些函数都将在运行时定义,因此编译后的服务器不会知道它们。 有没有办法在运行时加载函数
我使用 xmlrpc 服务器运行简单示例,然后按键盘上的 Ctrl-C :)。 from SimpleXMLRPCServer import SimpleXMLRPCServerfrom time i
我正在使用 HTML5 + Phonegap 进行移动应用程序开发。目前正在使用 XMLRPC 开发移动应用程序,并且运行良好。 (Android 和 iOS) 我需要在浏览器中运行与网站 相同的应用
我想创建非阻塞扭曲的 xmlrpc,但我不知道。我想在 xmlrpc 中调用方法,并且每次都从任何客户端执行我的方法,无需等待。这是我的代码: from pymongo import MongoCli
是否有可能允许 Python simplexmlrpc 服务器的 xmlrpc 扩展(数据类型 long int)? 客户端使用 Apache xmlrpc,allows 8 byte integer
我正在寻找一种方法来防止多个主机同时向 Python XMLRPC 监听器发出命令。监听器负责运行脚本以在该系统上执行任务,如果多个用户试图同时发出这些命令,这些任务将会失败。有没有一种方法可以阻止所
本文整理了Java中org.apache.xmlrpc.XmlRpcConfig类的一些代码示例,展示了XmlRpcConfig类的具体用法。这些代码示例主要来源于Github/Stackoverfl
对你们来说很简单的问题。 我可以通过 xmlrpc 删除未附加的媒体吗?如果是这样,请指导我了解什么功能可以做到这一点。谢谢 最佳答案 绝对可以,你用wp.deletePost以 post_id 作为
我的任务是创建一个 API,用于从 Flash 应用程序和旧版 CMS(非 PHP)检索内容并将其添加到 Wordpress。我的计划是利用现有的默认 xmlrpc 端点,并通过创建一个 Hook 到
所以我有一个 XMLRPC 服务器,它有一个名为 start_apps 的命令 通常从Python我会像这样运行它 import xmlrpclib app=xmlrpclib.ServerProxy
所以我有一个 XMLRPC 服务器,它有一个名为 start_apps 的命令 通常从Python我会像这样运行它 import xmlrpclib app=xmlrpclib.ServerProxy
我是一名优秀的程序员,十分优秀!