Java Code Examples for javax.faces.context.ExternalContext#getRequestContextPath()
The following examples show how to use
javax.faces.context.ExternalContext#getRequestContextPath() .
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: AuthBean.java From sailfish-core with Apache License 2.0 | 6 votes |
@PostConstruct public void init() { ExternalContext externalContext = FacesContext.getCurrentInstance() .getExternalContext(); originalURL = (String) externalContext.getRequestMap().get( RequestDispatcher.FORWARD_REQUEST_URI); if (originalURL == null) { originalURL = externalContext.getRequestContextPath() + "/index.xhtml"; } else { String originalQuery = (String) externalContext.getRequestMap() .get(RequestDispatcher.FORWARD_QUERY_STRING); if (originalQuery != null) { originalURL += "?" + originalQuery; } } }
Example 2
Source File: ServiceDetailsCtrl.java From development with Apache License 2.0 | 6 votes |
public String redirectToServiceDetails() { logger.logDebug("entering redirectToServiceDetails"); FacesContext context = FacesContext.getCurrentInstance(); ExternalContext extContext = context.getExternalContext(); String viewId = Marketplace.MARKETPLACE_ROOT + "/serviceDetails.jsf"; try { viewId = extContext.getRequestContextPath() + viewId + ui.getSelectedServiceKeyQueryPart(String.valueOf(model .getSelectedServiceKey())) + ui.getMarketplaceIdQueryPart(); String urlLink = context.getExternalContext().encodeActionURL( viewId); JSFUtils.redirect(extContext, urlLink); } catch (IOException e) { extContext.log( getClass().getName() + ".redirectToServiceDetails()", e); } finally { // reset requested key; model.setSelectedServiceKey(null); } return null; }
Example 3
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 4
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 5
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 6
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(); }