1.1 --- a/webidor/src/main/java/cz/xelfi/quoridor/webidor/resources/Quoridor.java Sun Aug 30 14:37:47 2009 +0200
1.2 +++ b/webidor/src/main/java/cz/xelfi/quoridor/webidor/resources/Quoridor.java Sun Aug 30 16:04:27 2009 +0200
1.3 @@ -33,6 +33,7 @@
1.4 import com.sun.net.httpserver.HttpServer;
1.5 import java.io.File;
1.6 import java.io.IOException;
1.7 +import java.net.ServerSocket;
1.8 import javax.ws.rs.Path;
1.9
1.10 /**
1.11 @@ -77,6 +78,11 @@
1.12 }
1.13
1.14 public static HttpServer start(int port) throws IOException {
1.15 + if (port == -1) {
1.16 + ServerSocket ss = new ServerSocket(0);
1.17 + port =ss.getLocalPort();
1.18 + ss.close();
1.19 + }
1.20 final String baseUri = "http://localhost:" + port + "/";
1.21
1.22 File home = new File(System.getProperty("user.home"));