1.1 --- a/webidor/src/main/java/cz/xelfi/quoridor/webidor/resources/Games.java Sun Sep 13 16:48:54 2009 +0200
1.2 +++ b/webidor/src/main/java/cz/xelfi/quoridor/webidor/resources/Games.java Wed Sep 16 22:28:11 2009 +0200
1.3 @@ -29,6 +29,8 @@
1.4 import cz.xelfi.quoridor.IllegalPositionException;
1.5 import cz.xelfi.quoridor.webidor.*;
1.6 import cz.xelfi.quoridor.Move;
1.7 +import cz.xelfi.quoridor.visidor.Visidor;
1.8 +import java.awt.Image;
1.9 import java.io.BufferedReader;
1.10 import java.io.BufferedWriter;
1.11 import java.io.File;
1.12 @@ -118,6 +120,17 @@
1.13
1.14 @GET
1.15 @Path("{id}")
1.16 + @Produces("image/png")
1.17 + public Image getBoardImage(@PathParam("id") String id) {
1.18 + Game g = findGame(id);
1.19 + if (g == null) {
1.20 + throw new IllegalArgumentException("Unknown game " + id);
1.21 + }
1.22 + return Visidor.draw(g.getBoard());
1.23 + }
1.24 +
1.25 + @GET
1.26 + @Path("{id}")
1.27 @Produces({ MediaType.APPLICATION_JSON, MediaType.TEXT_XML })
1.28 public Game getBoardInfo(@PathParam("id") String id) {
1.29 Game g = findGame(id);