当前位置: 首页>>代码示例>>Java>>正文


Java XSPContext.getXSPContext方法代码示例

本文整理汇总了Java中com.ibm.xsp.designer.context.XSPContext.getXSPContext方法的典型用法代码示例。如果您正苦于以下问题:Java XSPContext.getXSPContext方法的具体用法?Java XSPContext.getXSPContext怎么用?Java XSPContext.getXSPContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.ibm.xsp.designer.context.XSPContext的用法示例。


在下文中一共展示了XSPContext.getXSPContext方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toolbarClick

import com.ibm.xsp.designer.context.XSPContext; //导入方法依赖的package包/类
/**
 * Will be triggered by an outline onItemClick event. Can be used for toolbars, dropdown menus, etc.
 */
public void toolbarClick() {
	XSPContext context=XSPContext.getXSPContext(FacesContext.getCurrentInstance());
	String selection=context.getSubmittedValue();
	
	if("selectAll".equals(selection)) {
		selectAll();
	} else if("deselectAll".equals(selection)) {
		deselectAll();
	} else if("removeSelected".equals(selection)) {
		removeSelected();
	} else if("toggleLcv".equals(selection)) {
		toggleLcv();
	} else if("sortByLcv".equals(selection)) {
		sortByLcv();
	} else if("sortByName".equals(selection)) {
		sortByName();
	}
	
}
 
开发者ID:sbasegmez,项目名称:Blogged,代码行数:23,代码来源:ParticipantList.java

示例2: isLoggedIn

import com.ibm.xsp.designer.context.XSPContext; //导入方法依赖的package包/类
protected boolean isLoggedIn() {
    XSPContext ctx = XSPContext.getXSPContext(FacesContext.getCurrentInstance());
    if(ctx!=null) {
        com.ibm.designer.runtime.directory.DirectoryUser user = ctx.getUser();
        return !user.isAnonymous();
    }
    return false;
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:9,代码来源:LoginTreeNode.java

示例3: Message

import com.ibm.xsp.designer.context.XSPContext; //导入方法依赖的package包/类
public Message(Throwable error, String context) {
	
	StringBuilder sbHTML = new StringBuilder();
	StringBuilder sbDetails = new StringBuilder();
	
	if (error instanceof NotesException) {		//add error id
		errorId = ((NotesException) error).id;
		summary = ((NotesException) error).text;
		sbHTML.append( summary + " (" + errorId + ")");
	} else {
		summary = error.toString();
		sbHTML.append( error.toString() );
	}
	sbDetails.append( summary );
	
	StackTraceElement[] stes = error.getStackTrace();
	errorLine = stes[0].getLineNumber();
	errorMethod = stes[0].getMethodName();
	errorClassName = stes[0].getClassName();
	
	if (error.getClass().getName().equals( "javax.faces.FacesException") ) {
		
		sbHTML.append("<table cellpadding=\"0\" cellspacing=\"0\" class=\"errorDetails\"><tbody><tr><td colspan=\"2\"><b><u>Error details</u></b></td></tr>");
		sbDetails.append("\n\nError details\n\n");
	
		javax.faces.FacesException fE = (javax.faces.FacesException) error;
		
		if ( fE.getCause().getClass().getName().equals( "com.ibm.xsp.exception.EvaluationExceptionEx") ) {
			
			com.ibm.xsp.exception.EvaluationExceptionEx evEx = (com.ibm.xsp.exception.EvaluationExceptionEx) fE.getCause();
			
			if ( evEx.getCause().getClass().getName().equals("com.ibm.jscript.InterpretException") ) {
				
				com.ibm.jscript.InterpretException iEx = (com.ibm.jscript.InterpretException) evEx.getCause();
				
				sbHTML.append("<tr><td><b>Message:</b></td><td style=\"color: black;\">" + iEx.getMessage() + "</td></tr>");
				sbHTML.append("<tr><td><b>JavaScript code:</b></td><td style=\"color: black;\">" + iEx.getExpressionText().replace("\n", "<br />") + "</td></tr>");
				
				sbDetails.append("Message: " + iEx.getMessage() + "\n\n" );
				sbDetails.append("JavaScript code:\n\n" + iEx.getExpressionText() + "\n\n");
				
			}
			
			sbHTML.append("<tr><td><b>Caused by component:</b></td><td style=\"color: black;\">" + evEx.getErrorComponentId() + "</td></tr>");
			sbHTML.append("<tr><td><b>Property:</b></td><td style=\"color: black;\">" + evEx.getErrorPropertyId() + "</td></tr>" );
			
			sbDetails.append("Caused by component: " + evEx.getErrorComponentId() + "\n");
			sbDetails.append("Property: " + evEx.getErrorPropertyId() + "\n" );
		}
		
		XSPContext xspContext = XSPContext.getXSPContext(FacesContext.getCurrentInstance());
		String [] historyUrls = xspContext.getHistoryUrls();
		fromPage = historyUrls[historyUrls.length-1];
		
		if (fromPage.indexOf("?")>-1) {
			fromPage = fromPage.substring(0, fromPage.indexOf("?"));
		}
		if (fromPage.indexOf("/")==0) {
			fromPage = fromPage.substring(1);
		}
		
		sbHTML.append("<tr><td><b>In page:</b></td><td><a href=\"" + FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath() + "/" + fromPage + "\">" + fromPage + "</a></td></tr>");
		sbHTML.append("</tbody></table>");
		
		sbDetails.append("In page: " + fromPage);
	}
	
	this.details = sbDetails.toString();
	this.text = sbHTML.toString();
	this.type = TYPE_ERROR;
	this.context = context;
	this.date = new Date();
	
	//store stacktrace elements in a Vector
	stackTrace = new Vector<String>();
	for (StackTraceElement element : error.getStackTrace()) {
		stackTrace.add( element.toString() );
	}
}
 
开发者ID:sbasegmez,项目名称:ic14demos,代码行数:80,代码来源:Message.java

示例4: DebugToolbar

import com.ibm.xsp.designer.context.XSPContext; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public DebugToolbar() {
	
	try {
		activeTab = "";		//default tab: none
		
		toolbarVisible = false;
		collapsed = false;
		messages = new Vector<Message>(); 
		filterLogTypes = new Vector<String>();
		showLists = true;
		toolbarColor = "#38375B";		//default background color
		
		configLoaded = false;
		
		requestContextPath = FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
		consolePath = requestContextPath + "/debugToolbarConsole.xsp";
		
		dominoDataDir = com.ibm.xsp.model.domino.DominoUtils.getEnvironmentString("Directory");		//path to the domino/data directory
		dominoProgramDir =  com.ibm.xsp.model.domino.DominoUtils.getEnvironmentString("NotesProgram");		//path to the domino program directory
		
		inspectorShowHiddenComponents = false;
		inspectorComponentIdsOptions = new ArrayList<String>();
		inspectorExpression = new ArrayList<String>();
		
		logEnabled = false;
		
		dbCurrent = getCurrentDatabase();
		currentDbFilePath = dbCurrent.getFilePath();
		currentDbTitle = dbCurrent.getTitle();
		serverName = dbCurrent.getServer();
		dbCurrent.recycle();
		
		XSPContext context = XSPContext.getXSPContext(FacesContext.getCurrentInstance());
		
		userName = getSession().getUserName();
		effectiveUserName = getSession().getEffectiveUserName();
		userRoles = new Vector<String>(context.getUser().getRoles());
		
		notesVersion = getSession().getNotesVersion();
		
	} catch (Exception e) {

		e.printStackTrace();
	}
	
}
 
开发者ID:sbasegmez,项目名称:ic14demos,代码行数:48,代码来源:DebugToolbar.java

示例5: getCustomVars

import com.ibm.xsp.designer.context.XSPContext; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public ArrayList<Entry<String, String>> getCustomVars() {

	ArrayList customVars = new ArrayList<Entry<String,String>>();

	try {

		XSPContext context = XSPContext.getXSPContext(FacesContext.getCurrentInstance());
		
		DirectoryUser currentUser = context.getUser();

		Name n = getSession().createName(effectiveUserName);
		Vector<String> groups = new Vector(currentUser.getGroups());
		groups.remove(effectiveUserName);
		groups.remove(n.getCommon());
		
		extLibVersion = getExtLibVersion();
		
		ExternalContext extCon = FacesContext.getCurrentInstance().getExternalContext();
		
		HttpServletRequest httpServletRequest = (HttpServletRequest) extCon.getRequest();
		
		customVars.add( new AbstractMap.SimpleEntry("title", "User"));
		customVars.add( new AbstractMap.SimpleEntry("username", effectiveUserName));
		customVars.add( new AbstractMap.SimpleEntry("access level", getReadableAccessLevel(getCurrentDatabase().getCurrentAccessLevel())));
		
		customVars.add( new AbstractMap.SimpleEntry("roles", (userRoles.size()>0 ? userRoles.toString() : "(no roles enabled)") ));
		customVars.add( new AbstractMap.SimpleEntry("groups", (groups.size()>0 ? groups.toString() : "(user not listed in any group)")));

		customVars.add( new AbstractMap.SimpleEntry("title", "Browser"));
		customVars.add( new AbstractMap.SimpleEntry("name", context.getUserAgent().getBrowser() + " " + context.getUserAgent().getBrowserVersion()));
		customVars.add( new AbstractMap.SimpleEntry("user agent", context.getUserAgent().getUserAgent()));
		customVars.add( new AbstractMap.SimpleEntry("language", context.getLocale().getDisplayName()	+ " (" + context.getLocaleString() + ")"));
		customVars.add( new AbstractMap.SimpleEntry("timezone", context.getTimeZoneString()));

		customVars.add( new AbstractMap.SimpleEntry("title", "Server") );
		customVars.add( new AbstractMap.SimpleEntry("name", getCurrentDatabase().getServer() ) );
		customVars.add( new AbstractMap.SimpleEntry("version", notesVersion ) );
		customVars.add( new AbstractMap.SimpleEntry("platform", getSession().getPlatform() ) );
		customVars.add( new AbstractMap.SimpleEntry("extension library version", extLibVersion ) );
		
		customVars.add( new AbstractMap.SimpleEntry("title", "Database") );
		customVars.add( new AbstractMap.SimpleEntry("name", currentDbTitle ) );
		customVars.add( new AbstractMap.SimpleEntry("path", currentDbFilePath ) );
		
		
		customVars.add( new AbstractMap.SimpleEntry("size", DebugToolbar.getReadableSize( (long) getCurrentDatabase().getSize())));
		customVars.add( new AbstractMap.SimpleEntry("created", getCurrentDatabase().getCreated().toString()) );
		customVars.add( new AbstractMap.SimpleEntry("last modified", getCurrentDatabase().getLastModified().toString()));
		customVars.add( new AbstractMap.SimpleEntry("full text indexed?", (getCurrentDatabase().isFTIndexed() ? "yes (last update: " + getCurrentDatabase().getLastFTIndexed().toString() + ")" : "no")));

		customVars.add( new AbstractMap.SimpleEntry("title", "Request"));
		customVars.add( new AbstractMap.SimpleEntry("query string", context.getUrl().getQueryString()));
		customVars.add( new AbstractMap.SimpleEntry("remote address", httpServletRequest.getRemoteAddr()));
		
		customVars.add( new AbstractMap.SimpleEntry("cookies", getCookieDump(extCon.getRequestCookieMap()) ));

	} catch (Exception e) {
		error(e, "getCustomVars");

	}

	return customVars;

}
 
开发者ID:sbasegmez,项目名称:ic14demos,代码行数:66,代码来源:DebugToolbar.java

示例6: getXspContext

import com.ibm.xsp.designer.context.XSPContext; //导入方法依赖的package包/类
/**
 * Return the current XspContext.
 */
public static XSPContext getXspContext() {
    return XSPContext.getXSPContext(FacesContext.getCurrentInstance());
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:7,代码来源:ExtLibUtil.java


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