<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    java Source

      BlogJava :: 首頁 :: 聯(lián)系 :: 聚合  :: 管理
      14 Posts :: 24 Stories :: 8 Comments :: 0 Trackbacks
    package org.lambdasoft.web.support;

    import java.util.ArrayList;
    import java.util.Enumeration;
    import java.util.List;

    import javax.servlet.http.HttpSession;

    import org.apache.struts2.ServletActionContext;
    import org.lambdasoft.web.Enviroment;

    public class SessionSupport {
        
    private SessionSupport() {}
        
        
    /**
         * 獲取當前用戶Session
         * 
         * 
    @return httpSession
         
    */
        
    public final static HttpSession getSession() {
            
    return ServletActionContext.getRequest().getSession();
        }
        
        @SuppressWarnings(
    "unchecked")
        
    public final static void removeAllSession(HttpSession session) {
            
    if(session == null)
                
    return;
            Enumeration names 
    = session.getAttributeNames();
            
    if(names == null)
                
    return;
            List
    <String> sessionNamesList = new ArrayList<String>();
            
    while (names.hasMoreElements()) 
                sessionNamesList.add((String)names.nextElement());
            
    for (String sessionName : sessionNamesList) {
                session.removeAttribute(sessionName);
            }
        }
        
        
    /**
         * 添加或者更新Session票據(jù)信息
         * 
         * 
    @param sessionTick
         
    */
        
    public final static void updateSessionTick(SessionTick<TickInterface> sessionTick) {
            getSession().removeAttribute(Enviroment.getEnv().getEnv(
    "WEB_SESSION_KEY"));
            getSession().setAttribute(Enviroment.getEnv().getEnv(
    "WEB_SESSION_KEY"), sessionTick);
        }
        
        
    /**
         * 把用戶票據(jù)加入到Session
         * 
    @param account
         
    */
        
    public final static void addTickToSession(TickInterface account) {
            SessionTick
    <TickInterface> tick = new SessionTick<TickInterface>();
            tick.setAccount(account);
            updateSessionTick(tick);
        }
    }


    /*
     * SessionTick.java
     * Copyright (C) 2009  <JustinLei@gmail.com>
     *
     *        This program is free software; you can redistribute it and/or modify
     *        it under the terms of the GNU General Public License as published by
     *      the Free Software Foundation; either version 2 of the License, or
     *     (at your option) any later version.
     *
     *       This program is distributed in the hope that it will be useful,
     *      but WITHOUT ANY WARRANTY; without even the implied warranty of
     *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     *        GNU General Public License for more details.
     *
     
    */
    package org.lambdasoft.web.support;

    /**
     * Session Support
     * 
     * 
    @author lei.tang (justinlei@gmail.com)
     * @date 
     * 
    @version
     
    */
    import java.io.Serializable;

    public class SessionTick<extends TickInterface> implements Serializable{
        
    private static final long serialVersionUID = 1L;
        
    private T account = null;
        
        
    public SessionTick() {}
        
        
    public SessionTick(T account) {
            
    this.account = account;
        }
        
        
    public T getAccount() {
            
    return account;
        }
        
    public void setAccount(T account) {
            
    this.account = account;
        }
    }

    package org.lambdasoft.web.support;

    public interface TickInterface {
        Long getId();
    }
    posted on 2009-12-18 16:37 JustinLei 閱讀(1497) 評論(0)  編輯  收藏

    只有注冊用戶登錄后才能發(fā)表評論。


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: 国产极品美女高潮抽搐免费网站| 国产综合成人亚洲区| 三级黄色片免费看| 亚洲裸男gv网站| 免费国产高清毛不卡片基地| 国产色爽免费视频| 国产亚洲男人的天堂在线观看 | 免费一级特黄特色大片在线| 亚洲精品又粗又大又爽A片| 毛片基地免费视频a| 亚洲午夜精品一区二区麻豆| 女人被男人躁的女爽免费视频| 亚洲熟女综合色一区二区三区| 精品久久久久久久免费人妻| 特级毛片免费播放| 曰韩亚洲av人人夜夜澡人人爽| 久久免费观看视频| 亚洲av日韩av天堂影片精品| 亚洲毛片免费视频| 性色av极品无码专区亚洲| 亚洲av成人一区二区三区在线观看| 春意影院午夜爽爽爽免费| 亚洲乱码国产一区三区| 久久免费看黄a级毛片| 中文字幕亚洲综合久久综合| 无码国产亚洲日韩国精品视频一区二区三区| 丰满妇女做a级毛片免费观看| 精品亚洲永久免费精品| 四虎永久在线观看免费网站网址 | 好爽好紧好大的免费视频国产| 免费人成网上在线观看| 日韩亚洲一区二区三区| 国产情侣激情在线视频免费看| 亚洲成a∧人片在线观看无码| 精品国产日韩亚洲一区| GOGOGO高清免费看韩国| 亚洲av日韩av激情亚洲| 国产成人A在线观看视频免费| 一区二区3区免费视频| 久久久亚洲欧洲日产国码aⅴ | 亚洲欧洲一区二区三区|