/** @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response) */ protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { JsonList notices = new JsonList(); for (Notice n : Notice.getNotices()) { JsonMap notice = new JsonMap(); notice.put("nID", new JsonVal<Integer>(n.id)); notice.put("title", new JsonVal<String>(n.getTitle())); notice.put("href", new JsonVal<String>(n.getHref())); notices.add(notice); } response.setCharacterEncoding("UTF-8"); response.getWriter().print((new JsonMap("notices", notices)).toJsonStr()); } catch (Exception e) { e.printStackTrace(); } }
public JsonThing next() { int i = numReturned; numReturned = (i + 1); return new JsonThing(internal.next(), JsonList.access$1(path, i)); }