📄 hserver.java
字号:
//服务器程序将创建的管理器注册到服务器上,并为服务器指明应用程序其他特定的参数。//服务器类package temp; /** * * <b><code>HelloServer</code></b> is a simple XML-RPC server * that will take the <code>HelloHandler</code> class available * for XML-PRC calls. * */ import org.apache.xmlrpc.WebServer; import org.apache.xmlrpc.XmlRpc; import java.io.IOException; public class HServer { public static void main(String[] args){ if(args.length<1){ System.out.println("Usage: java HelloServer [port]"); System.exit(-1); } try{ XmlRpc.setDriver("org.apache.xerces.parsers.SAXParser"); //start the server System.out.println("Starting XML-RPC Server......"); WebServer server = new WebServer(Integer.parseInt(args[0])); //register our handler class server.addHandler("hello",new HHandler()); System.out.println("Now accepting requests......"); }catch(ClassNotFoundException e){ System.out.println("Could not locate SAX Driver"); }catch(Exception e){ System.out.println("Could not start server: "+e.getMessage()); } } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -