本文整理汇总了Java中com.ibm.domino.xsp.module.nsf.NotesContext类的典型用法代码示例。如果您正苦于以下问题:Java NotesContext类的具体用法?Java NotesContext怎么用?Java NotesContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NotesContext类属于com.ibm.domino.xsp.module.nsf包,在下文中一共展示了NotesContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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);
}
}
示例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$
}
示例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();
}
示例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();
}
示例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
}
}
示例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;
}
示例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);
}
}
示例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();
}
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
示例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");
}