⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 intramartsessionfactory.java

📁 intra_mart是日本NDD公司开发的著名企业应用解决方案中间件。集成了J2ee服务器
💻 JAVA
字号:
/*
 * IntramartSessionFactory.java
 *
 * Created on 2002/02/14, 21:14
 */

package jp.co.intra_mart.framework.base.session;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import jp.co.intra_mart.foundation.service.client.information.SessionMemory;

/**
 * intra-mart偺僙僢僔儑儞傪棙梡偡傞僙僢僔儑儞僆僽僕僃僋僩傪惗惉偟傑偡丅
 * 偙偺僋儔僗傪棙梡偡傞偨傔偵偼丄intra-mart傪僀儞僗僩乕儖偡傞昁梫偑偁傝傑偡丅
 *
 * @author INTRAMART
 * @version 1.0
 * @deprecated 偙偺僋儔僗偼屳姺惈偺偨傔偵巆偝傟偰偄傑偡丅HttpSession傪捈愙棙梡偡傞傛偆偵偟偰偔偩偝偄丅
 */
public class IntramartSessionFactory implements SessionFactory {

    /**
     * IntramartSessionFactory傪怴婯偵惗惉偟傑偡丅
     */
    public IntramartSessionFactory() {
    }

    /**
     * 僙僢僔儑儞僆僽僕僃僋僩傪怴婯偵惗惉偟傑偡丅
     *
     * @param request 儕僋僄僗僩
     * @return 僙僢僔儑儞僆僽僕僃僋僩
     * @throws SessionFactoryException 僙僢僔儑儞僆僽僕僃僋僩偺庢摼偵幐攕
     */
    public SessionObject createSessionObject(ServletRequest request) throws SessionFactoryException {
//        jp.co.intra_mart.foundation.service.client.information.SessionFactory factory = new jp.co.intra_mart.foundation.service.client.information.SessionFactory();
        jp.co.intra_mart.foundation.service.client.information.SessionFactory factory = new jp.co.intra_mart.foundation.service.client.information.SessionFactory((HttpServletRequest)request, null);
        IntramartSessionObject object = null;
//        String id = null;
        SessionManager manager;

        // 僙僢僔儑儞儅僱乕僕儍偺庢摼
        try {
            manager = SessionManager.getSessionManager();
        } catch (Exception e) {
            throw new SessionFactoryException(e.getMessage(), e);
        }

//        // 僙僢僔儑儞ID偺庢摼
//        try {
//            id = (String)((HttpServletRequest)request).getParameter(manager.getSessionPropertyHandler().getSessionParameter());
//        } catch (SessionPropertyException e) {
//            throw new SessionFactoryException(e.getMessage(), e);
//        }
//        if (id == null || id.equals("")) {
//            // 僙僢僔儑儞偑傑偩懚嵼偟側偄応崌
//            try {
//                // 僙僢僔儑儞傪怴婯偵惗惉
//                object = new IntramartSessionObject((SessionMemory)factory.getFile(factory.newIdentifier()));
//            } catch (Exception e) {
//                throw new SessionFactoryException(e.getMessage(), e);
//            }
//        } else {
//            // 僙僢僔儑儞偑偡偱偵懚嵼偡傞応崌
//            try {
//                // 婛懚偺僙僢僔儑儞傪庢摼
//                object = new IntramartSessionObject((SessionMemory)factory.getFile(id));
//            } catch (Exception e) {
//                throw new SessionFactoryException(e.getMessage(), e);
//            }
//        }
            try {
                // 僙僢僔儑儞傪怴婯偵惗惉
                object = new IntramartSessionObject((SessionMemory)factory.getFile());
            } catch (Exception e) {
                throw new SessionFactoryException(e.getMessage(), e);
            }

        return object;
    }

    /**
     * 僙僢僔儑儞忣曬傪URL偵娷傔偰僄儞僐乕僪偡傞昁梫偑偁傞偐偳偆偐挷傋傑偡丅
     *
     * @return 僄儞僐乕僪偑昁梫側応崌true丄偦偆偱側偄応崌false
     */
    public boolean isEncodeRequired() {
//        return false;
        return true;
    }

    /**
     * 僙僢僔儑儞ID傪僄儞僐乕僪偟偰URL偵捛壛偟傑偡丅
     * 捛壛偝傟傞撪梕偼僙僢僔儑儞僆僽僕僃僋僩偺幚憰偵埶懚偟傑偡丅
     *
     * @param request 儕僋僄僗僩
     * @param response 儗僗億儞僗
     * @param url 儕僋僄僗僩偺URL
     * @return 僙僢僔儑儞ID偑斀塮偝傟偨URL
     * @throws SessionFactoryException URL偺惗惉帪偵椺奜偑敪惗
     */
    public String encodeURL(ServletRequest request, ServletResponse response, String url) throws SessionFactoryException {
//        return url;
        return ((HttpServletResponse)response).encodeURL(url);
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -