• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java NotesContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.ibm.domino.xsp.module.nsf.NotesContext的典型用法代码示例。如果您正苦于以下问题:Java NotesContext类的具体用法?Java NotesContext怎么用?Java NotesContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NotesContext类属于com.ibm.domino.xsp.module.nsf包,在下文中一共展示了NotesContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createServer

import com.ibm.domino.xsp.module.nsf.NotesContext; //导入依赖的package包/类
private GroovyShellService createServer(ApplicationEx app, int port) {
	GroovyShellService service = new GroovyShellService();
	service.setPort(port);
	
	ClassLoader appClassLoader = getApplicationClassLoader(app);
	ClassLoader cl = new DelegatingClassLoader(appClassLoader, getClass().getClassLoader());
	
	service.setThreadFactory(new DominoGroovyThreadFactory(cl));
	service.setClassLoader(cl);
	
	service.setThreadInitCallback(() -> {
		if(NotesContext.getCurrentUnchecked() == null) {
			NotesContext context = new NotesContext(module);
			NotesContext.initThread(context);
		}
	});
	
	return service;
}
 
开发者ID:jesse-gallagher,项目名称:xsp-groovy-shell,代码行数:20,代码来源:ApplicationListener.java


示例2: openSessionCloner

import com.ibm.domino.xsp.module.nsf.NotesContext; //导入依赖的package包/类
public static Session openSessionCloner(){
	Session session = null;

	try{
		
		SessionCloner sessionCloner=SessionCloner.getSessionCloner();
		NSFComponentModule module= NotesContext.getCurrent().getModule();
		NotesContext context = new NotesContext( module );
		NotesContext.initThread( context );
		session = sessionCloner.getSession();
           
	}catch(NotesException n){
		logger.log(Level.SEVERE,null,n);

	}
	return session;

}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:19,代码来源:SessionFactory.java


示例3: logout

import com.ibm.domino.xsp.module.nsf.NotesContext; //导入依赖的package包/类
public static void logout(String url){    
	HttpSession httpSession = XSPUtils.getHttpSession();

	if(httpSession==null){
		return;
	}

	String sessionId = XSPUtils.getHttpSession().getId();
	XSPUtils.getRequest().getSession(false).invalidate();

	//wipe out the cookies
	for(Cookie cookie : getCookies()){
		cookie.setValue(StringCache.EMPTY);
		cookie.setPath("/");
		cookie.setMaxAge(0);
		XSPUtils.getResponse().addCookie(cookie);
	}

	try {
		NotesContext notesContext = NotesContext.getCurrent();
		notesContext.getModule().removeSession(sessionId);
		XSPUtils.externalContext().redirect(url);
	} catch (IOException e) {
		logger.log(Level.SEVERE,null,e);
	}
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:27,代码来源:XSPUtils.java


示例4: createEngine

import com.ibm.domino.xsp.module.nsf.NotesContext; //导入依赖的package包/类
public ServiceEngine createEngine(HttpServletRequest request, HttpServletResponse response) throws ServletException {
    String pathInfo = request.getPathInfo();
    ServiceFactory e = findServiceFactory(pathInfo);
    if(e!=null) {
        ServiceEngine engine = e.createEngine(request, response);
        if(engine instanceof RestDominoService) {
            NotesContext c = NotesContext.getCurrentUnchecked();
            if(c!=null) {
                RestDominoService ds = (RestDominoService)engine;
                ds.setDefaultSession(c.getCurrentSession());
                ds.setDefaultDatabase(c.getCurrentDatabase());
            }
        }
        return engine;
    }
    
    throw new ServletException(StringUtil.format("Unknown service {0}",pathInfo)); // $NLX-DefaultServiceFactory.Unknownservice0-1$
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:19,代码来源:DefaultServiceFactory.java


示例5: getDbUrlInName

import com.ibm.domino.xsp.module.nsf.NotesContext; //导入依赖的package包/类
public String getDbUrlInName(FacesContext context, UINotesDatabaseStoreComponent component) throws IOException{
    String dbName = component.getDatabaseName();
    StringBuilder b = new StringBuilder();
    try {
        Database database = null;
        if (StringUtil.isEmpty(dbName)) {
            database = NotesContext.getCurrent().getCurrentDatabase();
        } else {
            Session session = NotesContext.getCurrent().getCurrentSession();
            database = DominoUtils.openDatabaseByName(session, dbName);
        }
        String url = database.getHttpURL();
        String[] paths = url.split("/");
        for (int i = 0; i < 3 && i < paths.length; i++) {
            b.append(paths[i] + "/");
        }
        b.append(database.getFilePath().replaceAll("\\\\", "/"));
    } catch (NotesException e) {
        IOException ioe = new IOException(e.getMessage());
        ioe.initCause(e);
        throw ioe;
    }
    return b.toString();
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:25,代码来源:NotesDatabaseStoreRenderer.java


示例6: getDbUrl

import com.ibm.domino.xsp.module.nsf.NotesContext; //导入依赖的package包/类
public String getDbUrl(FacesContext context, UINotesDatabaseStoreComponent component) throws IOException{
    String dbName = component.getDatabaseName();
    StringBuilder b = new StringBuilder();
    try {
        Database database = null;
        if (StringUtil.isEmpty(dbName)) {
            database = NotesContext.getCurrent().getCurrentDatabase();
        }else{
            Session session = NotesContext.getCurrent().getCurrentSession();
            database = DominoUtils.openDatabaseByName(session, dbName);             
        }
        String url = database.getHttpURL();
        int idx = url.indexOf("?OpenDatabase"); // $NON-NLS-1$

        b.append(idx == -1 ? url : url.substring(0, idx));
    } catch (NotesException e) {
        IOException ioe = new IOException(e.getMessage());
        ioe.initCause(e);
        throw ioe;
    }
    
    return b.toString();
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:24,代码来源:NotesDatabaseStoreRenderer.java


示例7: addKeys

import com.ibm.domino.xsp.module.nsf.NotesContext; //导入依赖的package包/类
private void addKeys(FacesContext context) {
    Map<String, String> parameterMap = TypedUtil.getRequestParameterMap(context.getExternalContext());
    String startKey = parameterMap.get("startKey"); // $NON-NLS-1$
    String untilKey = parameterMap.get("untilKey"); // $NON-NLS-1$
    SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd'T'HHmmss"); // $NON-NLS-1$
    //System.out.println(startKey + " | " + untilKey);
    try {
        Date sDate = sdf.parse(startKey);
        Date eDate = sdf.parse(untilKey);
        DateRange dr =  NotesContext.getCurrent().getCurrentSession().createDateRange(sDate, eDate);
        //System.out.println(dr.toString());
        Vector v = new Vector(1);
        v.add(dr);
        DominoCalendarJsonLegacyService.this.setKeys(v);            
    } catch (Exception e) {
        // TODO MWD log exception but do not throw error
        // Just continue - all entries will be retrieved        
    }
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:20,代码来源:DominoCalendarJsonLegacyService.java


示例8: getXspSessionAsUser

import com.ibm.domino.xsp.module.nsf.NotesContext; //导入依赖的package包/类
public lotus.domino.Session getXspSessionAsUser() {
	final NSFComponentModule mod = this.module;
	lotus.domino.Session result = null;
	try {
		result = AccessController.doPrivileged(new PrivilegedExceptionAction<lotus.domino.Session>() {
			@Override
			public Session run() throws Exception {
				NotesContext nc = new NotesContext(mod);
				NotesContext.initThread(nc);
				long hList = com.ibm.domino.napi.c.NotesUtil.createUserNameList(username);
				return XSPNative.createXPageSession(username, hList, true, false);
			}
		});
	} catch (PrivilegedActionException e) {
		DominoUtils.handleException(e);
	}
	return result;
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:19,代码来源:BackgroundRunnable.java


示例9: XPageCurrentSessionFactory

import com.ibm.domino.xsp.module.nsf.NotesContext; //导入依赖的package包/类
public XPageCurrentSessionFactory() {
	super();
	final lotus.domino.Session rawSession = NotesContext.getCurrent().getCurrentSession();
	try {
		runAs_ = rawSession.getEffectiveUserName();
		lotus.domino.Database rawDb = rawSession.getCurrentDatabase();
		if (rawDb != null) {
			if (StringUtil.isEmpty(rawDb.getServer())) {
				currentApiPath_ = rawDb.getFilePath();
			} else {
				currentApiPath_ = rawDb.getServer() + "!!" + rawDb.getFilePath();
			}
		}
	} catch (NotesException e) {
		DominoUtils.handleException(e);
	}

}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:19,代码来源:XPageCurrentSessionFactory.java


示例10: applicationCreated

import com.ibm.domino.xsp.module.nsf.NotesContext; //导入依赖的package包/类
@Override
public void applicationCreated(ApplicationEx app) {
	if(usesLibrary(app)) {
		startService(app);
		
		NotesContext context = NotesContext.getCurrent();
		module = context.getModule();
	}
}
 
开发者ID:jesse-gallagher,项目名称:xsp-groovy-shell,代码行数:10,代码来源:ApplicationListener.java


示例11: database

import com.ibm.domino.xsp.module.nsf.NotesContext; //导入依赖的package包/类
public static final Database database(){
	Database db = ContextInfo.getUserDatabase();
	if(db==null){
		db = NotesContext.getCurrent().getCurrentDatabase();
		if(db == null){
			db = DominoUtils.getCurrentDatabase();
		}
	}
	return db;
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:11,代码来源:XSPUtils.java


示例12: isRendered

import com.ibm.domino.xsp.module.nsf.NotesContext; //导入依赖的package包/类
@Override
public boolean isRendered() {
	if(!super.isRendered()) {
		return false;
	}
	if(NotesContext.isClient()) {
		return false;
	}
	return super.isRendered();
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:11,代码来源:UserTreeNode.java


示例13: isRendered

import com.ibm.domino.xsp.module.nsf.NotesContext; //导入依赖的package包/类
@Override
public boolean isRendered() {
    if(!super.isRendered()) {
        return false;
    }
    if(NotesContext.isClient()) {
        return false;
    }
    if(isLoggedIn()) {
        if(!canLogout()) {
            return false;
        }
    }
    return true;
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:16,代码来源:LoginTreeNode.java


示例14: buildAgentClass

import com.ibm.domino.xsp.module.nsf.NotesContext; //导入依赖的package包/类
public XPageAgentJob buildAgentClass(XPageAgentEntry agenEntry, FacesContext fc) throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException {
	XPageAgentJob jbCurrent = null;
	Class<?>[] clArgs = new Class<?>[1];
	clArgs[0] = String.class;
	Constructor<?> ct = agenEntry.getAgent().getConstructor(clArgs);
	Object[] obArgs = new Object[1];
	obArgs[0] = agenEntry.getTitle();
	jbCurrent = (XPageAgentJob) ct.newInstance(obArgs);
	jbCurrent.setExecMode(agenEntry.getExecutionMode());
	jbCurrent.setDatabasePath(m_DatabasePath);
	jbCurrent.initCode(NotesContext.getCurrent().getModule(), SessionCloner.getSessionCloner(), fc);

	return jbCurrent;
}
 
开发者ID:OpenNTF,项目名称:XPagesToolkit,代码行数:15,代码来源:XPageAgentRegistry.java


示例15: initApplication

import com.ibm.domino.xsp.module.nsf.NotesContext; //导入依赖的package包/类
private void initApplication() {
	NSFComponentModule moduleCurrent = NotesContext.getCurrent().getModule();

	m_DatabasePath = moduleCurrent.getDatabasePath();
	m_Logger.info("MODUL - getDatabasePath(): " + moduleCurrent.getDatabasePath());
	registerAgents();

	m_Logger.info(m_Agents.size() + " Agents registered");
}
 
开发者ID:OpenNTF,项目名称:XPagesToolkit,代码行数:10,代码来源:XPageAgentRegistry.java


示例16: registerApplication2Master

import com.ibm.domino.xsp.module.nsf.NotesContext; //导入依赖的package包/类
public ExecutionUserProperties registerApplication2Master(String strUser, String strPassword) {
	try {
		String strHost = ((HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest()).getRequestURL().toString();
		int nNSF = strHost.toLowerCase().indexOf(".nsf");
		String strNSFURL = strHost.substring(0, nNSF) + ".nsf";
		String repid = NotesContext.getCurrentUnchecked().getCurrentDatabase().getReplicaID();
		return registerApplication2Master(strUser, strPassword, strNSFURL, repid);
	} catch (Exception e) {
		e.printStackTrace();
	}
	return null;
}
 
开发者ID:OpenNTF,项目名称:XPagesToolkit,代码行数:13,代码来源:XPTAgentBean.java


示例17: getApplicationStatus

import com.ibm.domino.xsp.module.nsf.NotesContext; //导入依赖的package包/类
public ApplicationStatus getApplicationStatus() {
	try {
		return XPageAgentManager.getInstance().getApplicationStatus(NotesContext.getCurrentUnchecked().getCurrentDatabase().getReplicaID());
	} catch (Exception e) {
		e.printStackTrace();
	}
	return null;
}
 
开发者ID:OpenNTF,项目名称:XPagesToolkit,代码行数:9,代码来源:XPTAgentBean.java


示例18: unregisterApplication

import com.ibm.domino.xsp.module.nsf.NotesContext; //导入依赖的package包/类
public boolean unregisterApplication() {
	try {
		return XPageAgentManager.getInstance().unregisterApplication(NotesContext.getCurrentUnchecked().getCurrentDatabase().getReplicaID());
	} catch (Exception e) {
		e.printStackTrace();
	}
	return false;
}
 
开发者ID:OpenNTF,项目名称:XPagesToolkit,代码行数:9,代码来源:XPTAgentBean.java


示例19: getProfileDocument

import com.ibm.domino.xsp.module.nsf.NotesContext; //导入依赖的package包/类
private Document getProfileDocument() {
	Document docProfile = null;
	try {
		Database ndbCurrent = NotesContext.getCurrentUnchecked().getCurrentDatabase();
		docProfile = ndbCurrent.getProfileDocument("XPTAmgrProps", ndbCurrent.getServer());
	} catch (Exception e) {
		LoggerFactory.logError(getClass(), "Error during getProfileDocument", e);
	}
	return docProfile;
}
 
开发者ID:OpenNTF,项目名称:XPagesToolkit,代码行数:11,代码来源:AmgrPropertiesHandler.java


示例20: registerApplication

import com.ibm.domino.xsp.module.nsf.NotesContext; //导入依赖的package包/类
private ExecutionUserProperties registerApplication(String strUserName, String strPassword, FacesContext context) throws NotesException {
	String host = getHostName();
	String protocol = getProtocol();
	if (host == null || protocol == null) {
		return XPTAgentBean.get(context).registerApplication2Master(strUserName, strPassword);
	} else {
		Database db = NotesContext.getCurrentUnchecked().getCurrentDatabase();
		String repid = db.getReplicaID();
		String path = db.getFilePath().replace("\\", "/");
		String url = protocol + host + path;
		return XPTAgentBean.get(context).registerApplication2Master(strUserName, strPassword, url, repid);
	}
}
 
开发者ID:OpenNTF,项目名称:XPagesToolkit,代码行数:14,代码来源:UIAgentList.java



注:本文中的com.ibm.domino.xsp.module.nsf.NotesContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TextFieldCompletionProvider类代码示例发布时间:2022-05-22
下一篇:
Java RTPManager类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap