Please sign in.
"); + + return; + } + + Objectify ofy = ObjectifyService.ofy(); + Game game = null; + String userId = userService.getCurrentUser().getUserId(); + if (gameKey != null) { + game = ofy.load().type(Game.class).id(gameKey).safe(); + if (game.getUserO() == null && !userId.equals(game.getUserX())) { + game.setUserO(userId); + } + ofy.save().entity(game).now(); + } else { + game = new Game(userId, null, " ", true); + ofy.save().entity(game).now(); + gameKey = game.getId(); + } + + ChannelService channelService = ChannelServiceFactory.getChannelService(); + String token = channelService.createChannel(game.getChannelKey(userId)); + + ofy.save().entity(game).now(); + + req.setAttribute("game_key", gameKey); + req.setAttribute("me", userId); + req.setAttribute("token", token); + req.setAttribute("initial_message", game.getMessageString()); + req.setAttribute("game_link", getGameUriWithGameParam(req, gameKey)); + getServletContext().getRequestDispatcher("/WEB-INF/view/index.jsp").forward(req, resp); + } +} diff --git a/appengine/channel/src/main/webapp/WEB-INF/appengine-web.xml b/appengine/channel/src/main/webapp/WEB-INF/appengine-web.xml new file mode 100644 index 00000000000..e4b0ccdddd7 --- /dev/null +++ b/appengine/channel/src/main/webapp/WEB-INF/appengine-web.xml @@ -0,0 +1,27 @@ + + +