src/main/java/com/google/codeu/servlets/UserServlet.java
/**
   * Responds with a JSON representation of {@link Message} data for a specific user. Responds with
   * an empty array if the user is not provided.
   */
Responds with a JSON representation of  Message data for a specific user. Responds with
an empty array if the user is not provided.
Responds with a JSON representation of Message data for a specific user . Responds with an empty array if the user is not provided .
@Override
  public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
    response.setContentType("application/json");
    String email = request.getParameter("email");
    if (email == null || email.equals("")) {
      response.getWriter().println("[]");
      return;
    }
    List<User> users = datastore.getUsers(email);
    Gson gson = new Gson();
    String json = gson.toJson(users);
    response.getWriter().println(json);
  }
@ Override public void doGet ( HttpServletRequest request , HttpServletResponse response ) throws IOException { response . setContentType ( "application/json" ) ; String email = request . getParameter ( "email" ) ; if ( email == null || email . equals ( "" ) ) { response . getWriter ( ) . println ( "[]" ) ; return ; } List < User > users = datastore . getUsers ( email ) ; Gson gson = new Gson ( ) ; String json = gson . toJson ( users ) ; response . getWriter ( ) . println ( json ) ; }
Responds with a JSON representation of {@link Message} data for a specific user.
Responds with a JSON representation of { @link Message } data for a specific user .
// Request is invalid, return empty array