Package parrot.server.data.objects

Examples of parrot.server.data.objects.User


        );
       
        st.bind(1, login);
       
        if (st.step()) {
          return new User(st.columnLong(0), login, st.columnString(2), st.columnString(1));
        } else {
          return null;
        }
      }
    }).complete();
View Full Code Here


        st.bind(3, name);
       
        st.step();

        long newId = connection.getLastInsertId();
        return new User(newId, login, password, name);
      }
    }).complete();
  }
View Full Code Here

        );

        LinkedList<User> resList = new LinkedList<>();

        while (st.step()) {
          resList.add(new User(
              st.columnLong(0),
              st.columnString(1),
              st.columnString(2),
              st.columnString(3)
            )
View Full Code Here

    sendJson(users);
  }

  private void responseAPIGetUser(String login) throws IOException, SQLiteException {
    responseHeaders(ResponseFormat.JSON, 200);
    User user = main.dataConnector.getUser(login);
    sendJson(user);
  }
View Full Code Here

    String name = request.getParameter("name");

    if (login != null && password1 != null && password2 != null && name != null) {
      if (password1.equals(password2)) {
        // Trying to find the user
        User user = main.dataConnector.getUser(login);
        if (user == null) {
          if (validateLogin(login)) {
            responseHeaders(ResponseFormat.JSON, 201);
            user = main.dataConnector.addUser(login, password1, name);
            sendJson(user);
View Full Code Here

  private void responseAPILogin() throws IOException {
    String login = request.getParameter("login");
    String password = request.getParameter("password");
    if (login != null && password != null) {
      // Validating login and password
      User user = main.dataConnector.getUser(login);
      if (user != null && user.password.equals(password)) {
        // Login complete
        Session session = main.sessionManager.createSession(login);

        responseHeaders(ResponseFormat.JSON, 200);
View Full Code Here

  }
 
  private void responseAPIAddMessage() throws IOException {
    String text = request.getParameter("text");
    Session session;
    final User user;
   
    Cookie sessionIdCookie = request.getCookie(COOKIE_SESSION_ID);
    if (sessionIdCookie != null && (session = main.sessionManager.fromCookie(sessionIdCookie)) != null) {
      // Session is open
      session = main.sessionManager.renewSession(session);
View Full Code Here

    sendJson(new APIErrorResponse(APIErrorResponse.CODE_LOGIN_REQUIRED, "You should login to write messages"));
  }

  private void responseUIRoot() throws IOException {
    Session session;
    final User user;
   
    Cookie sessionIdCookie = request.getCookie(COOKIE_SESSION_ID);
    if (sessionIdCookie != null && (session = main.sessionManager.fromCookie(sessionIdCookie)) != null) {
      // Session is open
      session = main.sessionManager.renewSession(session);
View Full Code Here

TOP

Related Classes of parrot.server.data.objects.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.