コード例 #1
0
        private HttpSessionImpl getSessionInternal()
        {
            if (this.cookies == null)
            {
                return(null);
            }
            Cookie cookie = null;

            foreach (Cookie tempCookie in this.cookies)
            {
                if (tempCookie.getName().Equals(SESSION_COOKIE_ID))
                {
                    cookie = tempCookie;
                }
            }

            SessionManager  manager = this.webApp.getSessionManager();
            HttpSessionImpl ret     = null;

            if (cookie != null)
            {
                ret = manager.getSession(cookie.getValue());
            }
            return(ret);
        }
コード例 #2
0
        public HttpSessionImpl createSession()
        {
            string          id      = this.sessionIdGenerator.generateSessionId();
            HttpSessionImpl session = new HttpSessionImpl(id);

            sessions.Add(id, session);
            return(session);
        }
コード例 #3
0
        public HttpSessionImpl getSession(string id)
        {
            HttpSessionImpl ret = sessions.get(id);

            if (ret != null)
            {
                ret.access();
            }
            return(ret);
        }
コード例 #4
0
 private void cleanSessions()
 {
     foreach (string id in sessions.Keys)
     {
         HttpSessionImpl session = this.sessions.get(id);
         if (session.getLastAccessedTime()
             < DateTime.Now.Ticks
             - (SESSION_TIMEOUT * 60 * 1000))
         {
             sessions.Remove(id);
         }
     }
 }
コード例 #5
0
 private HttpServletRequestImpl(string method, Map <string, string> requestHeader,
                                HttpServletResponseImpl resp,
                                WebApplication webApp)
 {
     this.method   = method;
     this.cookies  = parseCookies(requestHeader.get("COOKIE"));
     this.response = resp;
     this.webApp   = webApp;
     this.session  = getSessionInternal();
     if (this.session != null)
     {
         addSessionCookie();
     }
 }
コード例 #6
0
 public HttpSession getSession(bool create)
 {
     if (!create)
     {
         return(this.session);
     }
     if (this.session == null)
     {
         SessionManager manager = this.webApp.getSessionManager();
         this.session = manager.createSession();
         addSessionCookie();
     }
     return(this.session);
 }