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

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

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

    java Source

      BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
      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票據信息
         * 
         * 
    @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);
        }
        
        
    /**
         * 把用戶票據加入到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 閱讀(1489) 評論(0)  編輯  收藏

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


    網站導航:
     
    主站蜘蛛池模板: 亚洲精品无码专区在线在线播放 | 亚洲最大中文字幕| 四虎影视永久在线精品免费| 成人毛片视频免费网站观看| 亚洲娇小性色xxxx| 国产一卡二卡3卡四卡免费| 亚洲综合激情另类小说区| 日本免费一区二区三区| 亚洲黄色免费网址| 91九色精品国产免费| 亚洲国产av一区二区三区丶| 黄瓜视频影院在线观看免费| 中文字幕亚洲情99在线| 久久精品国产精品亚洲艾| 久久久久久久久久久免费精品| 亚洲一级片免费看| 三年片在线观看免费| 亚洲精品视频在线| 在线看免费观看AV深夜影院| 欧美亚洲国产SUV| 亚洲精品国产V片在线观看| 99在线热播精品免费99热| 亚洲人成在线播放网站岛国| 亚洲人成在线免费观看| 亚洲精品宾馆在线精品酒店 | 国产成人精品免费视频动漫| 最新亚洲精品国偷自产在线| 国产一级淫片a免费播放口之| 一级做a爱片特黄在线观看免费看| 久久99亚洲综合精品首页 | 亚洲欧洲免费无码| 牛牛在线精品免费视频观看| 亚洲一区二区三区影院| 2019中文字幕在线电影免费| 亚洲日韩乱码中文字幕| 国产日韩成人亚洲丁香婷婷| 97在线视频免费公开观看| 亚洲国产精品久久久久秋霞小| 国产亚洲成归v人片在线观看| 91精品免费在线观看| 一级毛片免费播放男男|