1.1 --- a/freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java Sat Aug 29 16:15:20 2009 +0200
1.2 +++ b/freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java Sun Aug 30 14:37:47 2009 +0200
1.3 @@ -60,6 +60,7 @@
1.4 import org.codehaus.jettison.json.JSONArray;
1.5 import org.codehaus.jettison.json.JSONException;
1.6 import org.codehaus.jettison.json.JSONObject;
1.7 +import org.w3c.dom.Document;
1.8
1.9 /**
1.10 *
1.11 @@ -173,10 +174,6 @@
1.12 }
1.13
1.14
1.15 - private static Object getJson(WebResource res) throws JSONException {
1.16 - return convert(res.accept(MediaType.APPLICATION_JSON_TYPE).get(JSONArray.class));
1.17 - }
1.18 -
1.19 private static Object convert(Object obj) throws JSONException {
1.20 if (obj instanceof JSONArray) {
1.21 JSONArray arr = (JSONArray)obj;
1.22 @@ -226,7 +223,8 @@
1.23 }
1.24
1.25 private Viewable welcomeImpl() throws JSONException {
1.26 - Object obj = getJson(base.path("games"));
1.27 + final Object got = base.path("games").accept(MediaType.TEXT_XML_TYPE).get(Document.class);
1.28 + Map<?,?> obj = (Map<?, ?>)convert(got);
1.29 return new Viewable("index.fmt", obj);
1.30 }
1.31