Package parrot.server.SessionManager

Examples of parrot.server.SessionManager.Session


    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);
        //response.setCookie(session.asCookie(COOKIE_SESSION_ID));
        sendJson(session);
      } else {
View Full Code Here


  }
 
  private void responseAPILogout() throws IOException {
    Cookie sessionIdCookie = request.getCookie(COOKIE_SESSION_ID);
    if (sessionIdCookie != null) {
      Session session = main.sessionManager.fromCookie(sessionIdCookie);
      if (session != null) {
        main.sessionManager.eraseSession(session);
      }
    }
    responseHeaders(ResponseFormat.JSON, 200);
View Full Code Here

    sendJson(new Object());
  }
 
  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
View Full Code Here

  }

  private void responseAPIGetMessages() throws IOException {
    Cookie sessionIdCookie = request.getCookie(COOKIE_SESSION_ID);
    if (sessionIdCookie != null) {
      Session session = main.sessionManager.fromCookie(sessionIdCookie);
      if (session != null) {
        Message[] messages = main.dataConnector.getMessages();
        sendJson(messages);
        return;
      }
View Full Code Here

    responseHeaders(ResponseFormat.JSON, 403);
    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
View Full Code Here

TOP

Related Classes of parrot.server.SessionManager.Session

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.