void doGiveHint(HanabiGame game, HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException, HanabiException { String target = req.getParameter("target"); String hint = req.getParameter("hint"); game.giveHint(target, hint); JsonGenerator out = new JsonFactory().createJsonGenerator(resp.getOutputStream()); out.writeStartObject(); out.writeStringField("message", "hint given; " + game.hintsLeft + " hints left"); out.writeEndObject(); out.close(); }