advogatoserver.java

来自「里面包含了多个java的编程示例!而且举出初学者常常遇到的错误!」· Java 代码 · 共 34 行

JAVA
34
字号
import java.io.*;
import nu.xom.*;
import org.apache.xmlrpc.*;

public class AdvogatoServer {
    int port = 80;
    WebServer server;
    
    public AdvogatoServer() throws IOException, ParsingException {
        // create the server
        System.out.println("Creating server on port " + port);
        server = new WebServer(port);
        
        // register the request handler
        AdvogatoHandler handler = new AdvogatoHandler();
        server.addHandler("test", handler);
    }
    
    public void start() {
        // start the server
        System.out.println("Now accepting requests ...");
        server.start();
    }
    
    public static void main(String[] arguments) {
        try {
            AdvogatoServer advo = new AdvogatoServer();
            advo.start();
        } catch (Exception exception) {
            System.out.println("Error: " + exception.getMessage());
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?