Java Code Examples for javax.faces.context.ExternalContext#getRequestServletPath()
The following examples show how to use
javax.faces.context.ExternalContext#getRequestServletPath() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BsfResWrapper.java From BootsFaces-OSP with Apache License 2.0 | 6 votes |
@Override public String getRequestPath() { ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext(); String mapping = externalContext.getRequestServletPath(); if (externalContext.getRequestPathInfo() == null) { mapping = mapping.substring(mapping.lastIndexOf('.')); } String path = super.getRequestPath(); if (mapping.charAt(0) == '/') { return path.replaceFirst(mapping, ""); } else if (path.contains("?")) { return path.replace(mapping + "?", "?"); } else { return path.substring(0, path.length() - mapping.length()); } }
Example 2
Source File: UIJsonRpcService.java From XPagesExtensionLibrary with Apache License 2.0 | 6 votes |
public String getUrlPath(FacesContext context, String pathInfo, String extraPathInfo) { ExternalContext externalContext = context.getExternalContext(); String contextPath = externalContext.getRequestContextPath(); String servletPath = externalContext.getRequestServletPath(); StringBuilder b = new StringBuilder(); b.append(contextPath); b.append(servletPath); // If there is a path info, use it as part of the URL if (StringUtil.isNotEmpty(pathInfo)) { b.append("/"); b.append(pathInfo); // the extra path info is only valid in this case if (StringUtil.isNotEmpty(extraPathInfo)) { b.append("/"); b.append(extraPathInfo); } } return b.toString(); }
Example 3
Source File: ClientWindowHelper.java From deltaspike with Apache License 2.0 | 6 votes |
public static String constructRequestUrl(ExternalContext externalContext) { String url = externalContext.getRequestContextPath() + externalContext.getRequestServletPath(); if (externalContext.getRequestPathInfo() != null) { url += externalContext.getRequestPathInfo(); } url = JsfUtils.addRequestParameters(externalContext, url, true); //TODO check if it isn't better to fix addRequestParameters itself //only #encodeResourceURL is portable currently url = externalContext.encodeResourceURL(url); return url; }
Example 4
Source File: UIBaseRestService.java From XPagesExtensionLibrary with Apache License 2.0 | 5 votes |
public String getUrlPath(FacesContext context, String pathInfo, String extraPathInfo) { ExternalContext externalContext = context.getExternalContext(); String contextPath = externalContext.getRequestContextPath(); String servletPath = externalContext.getRequestServletPath(); StringBuilder b = new StringBuilder(); b.append(contextPath); b.append(servletPath); // If there is a path info, use it as part of the URL if(StringUtil.isNotEmpty(pathInfo)) { if(!pathInfo.startsWith("/")) { b.append("/"); } b.append(pathInfo); // the extra path info is only valid in this case if (StringUtil.isNotEmpty(extraPathInfo)) { b.append("/"); b.append(extraPathInfo); } } //MNIA9UCECY String url= b.toString(); url=DominoUtils.handleProxyPrefix(url); return url; }
Example 5
Source File: ExtLibUtil.java From XPagesExtensionLibrary with Apache License 2.0 | 5 votes |
/** * Compose the URL for an Ajax partial refresh request related. */ public static String getPartialRefreshUrl(FacesContext context, UIComponent component) { ExternalContext ctx = context.getExternalContext(); String contextPath = ctx.getRequestContextPath(); String servletPath = ctx.getRequestServletPath(); StringBuilder b = new StringBuilder(); b.append(contextPath); b.append(servletPath); // Add the component id String ajaxId = component.getClientId(context); b.append('?'); b.append(AjaxUtil.AJAX_COMPID); b.append("="); b.append(ajaxId); // Add the view specific id String vid = UniqueViewIdManager.getUniqueViewId(context.getViewRoot()); if(StringUtil.isNotEmpty(vid)) { b.append('&'); b.append(AjaxUtil.AJAX_VIEWID); b.append("="); b.append(vid); } return b.toString(); }