本文整理汇总了Java中com.ibm.xsp.util.FacesUtil.isAbsoluteUrl方法的典型用法代码示例。如果您正苦于以下问题:Java FacesUtil.isAbsoluteUrl方法的具体用法?Java FacesUtil.isAbsoluteUrl怎么用?Java FacesUtil.isAbsoluteUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.ibm.xsp.util.FacesUtil
的用法示例。
在下文中一共展示了FacesUtil.isAbsoluteUrl方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: encodeHref
import com.ibm.xsp.util.FacesUtil; //导入方法依赖的package包/类
private static String encodeHref(FacesContext context, String href) {
if(href==null) {
return null;
}
if (!FacesUtil.isAbsoluteUrl(href)) {// $NON-NLS-1$
// adapt relative URLS
// [Note, this used to check the target property too, like
// StringUtil.isEmpty(target) && !isGlobalResourceUri(href)
// but that check was removed as part of TSOE7R7LUG
// We think this had been introduced for managing some portal
// behaviors where targets where not available. On Domino
// it should encode the actions when a target is present. ]
if ( !isGlobalResourceUri(href) ) {
// We have 3 kinds of URLs:
// 1. dir/resource
// Relative to the current page - nothing should be done
// 2. /dir/resource
// Relative to the app root - should adapt it using getResourceURL()
// 3. /[appcontextpath/dir/resource
// Relative to the app context path. Nothing should then be done here
if (href.startsWith("/")) { // $NON-NLS-1$
String appContextPath = context.getExternalContext().getRequestContextPath();
if (!href.startsWith(appContextPath)){
ViewHandler viewHandler = context.getApplication()
.getViewHandler();
href = viewHandler.getResourceURL(context, href);
}
}
// If this URL is pointing to an xsp page, then we should encode it as an action URL
// This encoding delegates to the servlet engine and add a sessionId parameter if
// needed (cookies not enabled, for example).
if(RenderUtil.isXspUrl(href)) {
href = context.getExternalContext().encodeActionURL(href);
} else {
href = context.getExternalContext().encodeResourceURL(href);
}
} else {
// This is a global url, starting with "/.ibmxspres/"
// we had to add a prefix if requested
href = context.getExternalContext().encodeResourceURL(href);
}
}
return href;
}