@@ -0,0 +1,1742 @@
+package com.google.vinet.servlets;%0A%0Aimport com.google.appengine.api.datastore.*;%0Aimport com.google.appengine.api.users.*;%0Aimport com.google.gson.*;%0Aimport java.io.*;%0Aimport javax.servlet.annotation.*;%0Aimport javax.servlet.http.*;%0A%0A@WebServlet(%22/ticket%22)%0Apublic class TicketsServlet  extends HttpServlet%7B%0A  private final DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();%0A  private final UserService userService = UserServiceFactory.getUserService();%0A  private final RegistrationServlet registrationServlet = new RegistrationServlet();%0A%0A  @Override%0A  public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException %7B%0A    if (response == null) %7B%0A      throw new IllegalArgumentException(%22response must not be null%22);%0A    %7D%0A%0A    if (request == null) %7B%0A      throw new IllegalArgumentException(%22request must not be null%22);%0A    %7D%0A%0A    if (!this.userService.isUserLoggedIn()) %7B%0A      response.sendError(%0A          HttpServletResponse.SC_UNAUTHORIZED, %22user must be logged in to fetch a request%22);%0A      return;%0A    %7D%0A%0A    final boolean registered = registrationServlet.isUserRegistered(this.userService);%0A%0A    if (!registered) %7B%0A      response.sendError(%0A          HttpServletResponse.SC_UNAUTHORIZED, %22user must be registered to fetch a request%22);%0A      return;%0A    %7D%0A%0A    String id = request.getParameter(%22id%22);%0A%0A    Key key = KeyFactory.createKey(%22Ticket%22, Long.parseLong(id));%0A%0A    System.out.println(key);%0A%0A    try %7B%0A      Gson gson = new GsonBuilder().setPrettyPrinting().create();%0A      response.getWriter().println(gson.toJson(datastore.get(key).getProperties()));%0A    %7D catch (Exception exception) %7B%0A      response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);%0A    %7D%0A  %7D%0A%7D

Add TicketsServlet