當前位置: 首頁>>代碼示例>>Java>>正文


Java Session類代碼示例

本文整理匯總了Java中lucee.runtime.type.scope.Session的典型用法代碼示例。如果您正苦於以下問題:Java Session類的具體用法?Java Session怎麽用?Java Session使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Session類屬於lucee.runtime.type.scope包,在下文中一共展示了Session類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getInstance

import lucee.runtime.type.scope.Session; //導入依賴的package包/類
/**
 * load an new instance of the client datasource scope
 * @param cacheName 
 * @param appName
 * @param pc
 * @return client datasource scope
 * @throws PageException
 */
public synchronized static Session getInstance(String cacheName, String appName, PageContext pc, Session existing, Log log) throws PageException {
	StorageValue sv = _loadData(pc, cacheName, appName,"session", log);
	if(appName!=null && appName.startsWith("no-in-memory-cache-")) existing=null;
	if(sv!=null) {
		long time = sv.lastModified();
		
		if(existing instanceof StorageScopeCache) {
			if(((StorageScopeCache)existing).lastModified()>=time) {
				return existing;
			}
		}
		return new SessionCache(pc,cacheName,appName,sv.getValue(),time);
	}
	else if(existing!=null) {
		return  existing;
	}
	
	SessionCache session = new SessionCache(pc,cacheName,appName,new StructImpl(),0);
	session.store(pc.getConfig());
	return session;
}
 
開發者ID:lucee,項目名稱:Lucee4,代碼行數:30,代碼來源:SessionCache.java

示例2: getInstance

import lucee.runtime.type.scope.Session; //導入依賴的package包/類
/**
 * load an new instance of the client datasource scope
 * @param cacheName 
 * @param appName
 * @param pc
 * @return client datasource scope
 * @throws PageException
 */
public synchronized static Session getInstance(String cacheName, String appName, PageContext pc, Session existing, Log log) throws PageException {
	StorageValue sv = _loadData(pc, cacheName, appName,"session", log);
	if(appName!=null && appName.startsWith("no-in-memory-cache-")) existing=null;
	if(sv!=null) {
		long time = sv.lastModified();
		
		if(existing instanceof StorageScopeCache) {
			if(((StorageScopeCache)existing).lastModified()>=time) {
				return existing;
			}
		}
		return new SessionCache(pc,cacheName,appName,sv.getValue(),time);
	}
	else if(existing!=null) {
		return  existing;
	}

	SessionCache session = new SessionCache(pc,cacheName,appName,new StructImpl(),0);
	session.store(pc);
	return session;
}
 
開發者ID:lucee,項目名稱:Lucee,代碼行數:30,代碼來源:SessionCache.java

示例3: getInstance

import lucee.runtime.type.scope.Session; //導入依賴的package包/類
public static Session getInstance(String datasourceName, PageContext pc, Log log,Session defaultValue) {
	try {
		return getInstance(datasourceName, pc,log);
	}
	catch (PageException e) {}
	return defaultValue;
}
 
開發者ID:lucee,項目名稱:Lucee4,代碼行數:8,代碼來源:SessionDatasource.java

示例4: getInstance

import lucee.runtime.type.scope.Session; //導入依賴的package包/類
/**
 * load new instance of the class
 * @param name
 * @param pc
 * @return
 */
public static Session getInstance(String name, PageContext pc,Log log) {
	if(!StringUtil.isEmpty(name))
		name=StringUtil.toUpperCase(StringUtil.toVariableName(name));
	String cookieName="CF_"+TYPE+"_"+name;
	return new SessionCookie(pc,cookieName, _loadData(pc,cookieName,SCOPE_SESSION,"session",log));
}
 
開發者ID:lucee,項目名稱:Lucee4,代碼行數:13,代碼來源:SessionCookie.java

示例5: sessionScope

import lucee.runtime.type.scope.Session; //導入依賴的package包/類
public Session sessionScope(boolean checkExpires) throws PageException {
	if(session==null)	{
		checkSessionContext();
		session=scopeContext.getSessionScope(this,DUMMY_BOOL);
	}
	return session;
}
 
開發者ID:lucee,項目名稱:Lucee4,代碼行數:8,代碼來源:PageContextImpl.java

示例6: getInstance

import lucee.runtime.type.scope.Session; //導入依賴的package包/類
public static Scope getInstance(int scope, IKHandler handler, String appName, String name, PageContext pc, Session existing, Log log, Session defaultValue) {
	try {
		return getInstance(scope, handler, appName, name, pc,existing, log);
	}
	catch (PageException e) {}
	return defaultValue;
}
 
開發者ID:lucee,項目名稱:Lucee,代碼行數:8,代碼來源:IKStorageScopeSupport.java

示例7: getStorageScope

import lucee.runtime.type.scope.Session; //導入依賴的package包/類
public static StorageScope getStorageScope(PageContext pc) throws PageException {
	Session session = pc.sessionScope();
	if(!(session instanceof StorageScope))
		throw new ExpressionException("this function only works with CF Sessions");
	return (StorageScope) session;
}
 
開發者ID:lucee,項目名稱:Lucee4,代碼行數:7,代碼來源:CSRFGenerateToken.java

示例8: getInstance

import lucee.runtime.type.scope.Session; //導入依賴的package包/類
/**
 * load new instance of the class
 * @param name
 * @param pc
 * @param checkExpires 
 * @return
 */
public static Session getInstance(String name, PageContext pc,Log log) {

	Resource res=_loadResource(pc.getConfig(),SCOPE_SESSION,name,pc.getCFID());
	Struct data=_loadData(pc,res,log);
	return new SessionFile(pc,res,data);
}
 
開發者ID:lucee,項目名稱:Lucee4,代碼行數:14,代碼來源:SessionFile.java

示例9: sessionScope

import lucee.runtime.type.scope.Session; //導入依賴的package包/類
/**
 * @return session scope
 * @throws PageException
 */
public abstract Session sessionScope() throws PageException;
 
開發者ID:lucee,項目名稱:Lucee4,代碼行數:6,代碼來源:PageContext.java

示例10: getInstance

import lucee.runtime.type.scope.Session; //導入依賴的package包/類
/**
 * load a new instance of the class
 * @param pc
 * @param isNew 
 * @return
 */
public static Session getInstance(PageContext pc, RefBoolean isNew, Log log) {
	isNew.setValue(true);
	return new SessionMemory(pc,log);
}
 
開發者ID:lucee,項目名稱:Lucee4,代碼行數:11,代碼來源:SessionMemory.java


注:本文中的lucee.runtime.type.scope.Session類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。