summaryrefslogtreecommitdiff
path: root/jsonrpc/src/main/java/com/orbekk/rpc/App.java
blob: e11200844e8338bce9ff0c38f86f817cde991d68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package com.orbekk.rpc;

import org.eclipse.jetty.server.Server;

import com.googlecode.jsonrpc4j.JsonRpcServer;

public class App {
    public static void main(String[] args) {
        PingService service = new PingServiceImpl();
        JsonRpcServer jsonServer = new JsonRpcServer(service, PingService.class);   
    
        Server server = new Server(10080);
        RpcHandler rpcHandler = new RpcHandler(jsonServer);
        server.setHandler(rpcHandler);

        try {
            server.start();
        } catch (Exception e) {
            System.out.println("Could not start jetty server.");
            e.printStackTrace();
        }
        
        try {
            server.join();
        } catch (InterruptedException e) {
            System.out.println("Interrupt");
        }
    }
}