1.1 --- a/freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java Sat Sep 19 08:18:39 2009 +0200
1.2 +++ b/freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java Sat Sep 19 12:51:50 2009 +0200
1.3 @@ -34,6 +34,8 @@
1.4 import com.sun.jersey.api.core.ResourceConfig;
1.5 import com.sun.jersey.api.view.Viewable;
1.6 import com.sun.net.httpserver.HttpServer;
1.7 +import cz.xelfi.quoridor.Board;
1.8 +import cz.xelfi.quoridor.IllegalPositionException;
1.9 import java.io.File;
1.10 import java.io.IOException;
1.11 import java.io.InputStream;
1.12 @@ -58,6 +60,7 @@
1.13 import javax.ws.rs.core.MediaType;
1.14 import javax.ws.rs.core.NewCookie;
1.15 import javax.ws.rs.core.Response;
1.16 +import org.openide.util.Exceptions;
1.17 import org.w3c.dom.Document;
1.18
1.19 /**
1.20 @@ -151,7 +154,14 @@
1.21 return v;
1.22 }
1.23 Document doc = base.path("games").path(id).accept(MediaType.TEXT_XML).get(Document.class);
1.24 - return viewable("game.fmt", doc, "message", msg, "format", format);
1.25 + Board b;
1.26 + try {
1.27 + b = Board.valueOf(doc.getElementsByTagName("board").item(0).getTextContent());
1.28 + } catch (IllegalPositionException ex) {
1.29 + Exceptions.printStackTrace(ex);
1.30 + b = Board.empty();
1.31 + }
1.32 + return viewable("game.fmt", doc, "message", msg, "format", format, "board", b);
1.33 }
1.34
1.35 @GET