/** * Returns the link for the given resource in the current project, with full server prefix.<p> * * Like <code>http://site.enterprise.com:8080/index.html</code>.<p> * * In case the resource name is a full root path, the site from the root path will be used. * Otherwise the resource is assumed to be in the current site set be the OpenCms user context.<p> * * @param cms the current OpenCms user context * @param resourceName the resource to generate the online link for * * @return the link for the given resource in the current project, with full server prefix * * @see #getOnlineLink(CmsObject, String) */ public String getServerLink(CmsObject cms, String resourceName) { return getServerLink(cms, resourceName, false); }
/** * Returns the given link resolved according to the OpenCms context and export rules.<p> * * @param target the link target to resolve * * @return the given link resolved according to the OpenCms context and export rules */ protected String getLink(String target) { return OpenCms.getLinkManager().substituteLink(m_cms, target); }
/** * @see org.apache.commons.collections.Transformer#transform(java.lang.Object) */ public Object transform(Object input) { return OpenCms.getLinkManager().substituteLink( getCmsObject(), CmsLinkManager.getAbsoluteUri(String.valueOf(input), getCmsObject().getRequestContext().getUri())); } }
/** * Returns the link for the given workplace resource. * * This should only be used for resources under /system or /shared.<p< * * @param cms the current OpenCms user context * @param resourceName the resource to generate the online link for * @param forceSecure forces the secure server prefix * * @return the link for the given resource */ public String getWorkplaceLink(CmsObject cms, String resourceName, boolean forceSecure) { String result = substituteLinkForUnknownTarget(cms, resourceName, forceSecure); return appendServerPrefix(cms, result, resourceName, true); }
return OpenCms.getLinkManager().substituteLink(cms, m_uri); return OpenCms.getLinkManager().substituteLink(cms, m_uri); return OpenCms.getLinkManager().getServerLink(cms, m_uri); return OpenCms.getLinkManager().substituteLink(cms, getVfsUri(), siteRoot); } else {
/** * Returns a link <i>from</i> the URI stored in the provided OpenCms user context * <i>to</i> the given <code>link</code>, for use on web pages.<p> * * A number of tests are performed with the <code>link</code> in order to find out how to create the link:<ul> * <li>If <code>link</code> is empty, an empty String is returned. * <li>If <code>link</code> starts with an URI scheme component, for example <code>http://</code>, * and does not point to an internal OpenCms site, it is returned unchanged. * <li>If <code>link</code> is an absolute URI that starts with a configured site root, * the site root is cut from the link and * the same result as {@link #substituteLink(CmsObject, String, String)} is returned. * <li>Otherwise the same result as {@link #substituteLink(CmsObject, String)} is returned. * </ul> * * @param cms the current OpenCms user context * @param link the link to process * * @return a link <i>from</i> the URI stored in the provided OpenCms user context * <i>to</i> the given <code>link</code> */ public String substituteLinkForUnknownTarget(CmsObject cms, String link) { return substituteLinkForUnknownTarget(cms, link, false); }
/** * Allows requests to be dispatched to internal VFS resources or * external JSP pages, overloads the standard servlet API <code>getRequestDispatcher()</code> method.<p> * * @param target the target for the request dispatcher * * @return a special RequestDispatcher that allows access to VFS resources */ @Override public javax.servlet.RequestDispatcher getRequestDispatcher(String target) { String absolutUri = CmsLinkManager.getAbsoluteUri(target, m_controller.getCurrentRequest().getElementUri()); return new CmsFlexRequestDispatcher( m_controller.getTopRequest().getRequestDispatcher(absolutUri), absolutUri, null); }
/** * Returns a link to a file in the OpenCms VFS * that has been adjusted according to the web application path and the * OpenCms static export rules.<p> * * Since OpenCms version 7.0.2, you can also use this method in case you are not sure * if the link is internal or external, as * {@link CmsLinkManager#substituteLinkForUnknownTarget(org.opencms.file.CmsObject, String)} * is used to calculate the link target.<p> * * Relative links are converted to absolute links, using the current element URI as base.<p> * * @param target the link that should be calculated, can be relative or absolute * @param req the current request * * @return the target link adjusted according to the web application path and the OpenCms static export rules * * @see org.opencms.staticexport.CmsLinkManager#substituteLinkForUnknownTarget(org.opencms.file.CmsObject, String) */ public static String linkTagAction(String target, ServletRequest req) { CmsFlexController controller = CmsFlexController.getController(req); return OpenCms.getLinkManager().substituteLinkForUnknownTarget( controller.getCmsObject(), CmsLinkManager.getAbsoluteUri(target, controller.getCurrentRequest().getElementUri())); }
link = OpenCms.getLinkManager().getServerLink(cms, value); String sPath = cms.getSitePath(content.getFile()); link = OpenCms.getLinkManager().substituteLinkForUnknownTarget(cms, sPath);
/** * Returns the online link for the given resource, with full server prefix.<p> * * Like <code>http://site.enterprise.com:8080/index.html</code>.<p> * * In case the resource name is a full root path, the site from the root path will be used. * Otherwise the resource is assumed to be in the current site set be the OpenCms user context.<p> * * Please note that this method will always return the link as it will appear in the "Online" * project, that is after the resource has been published. In case you need a method that * just returns the link with the full server prefix, use {@link #getServerLink(CmsObject, String)}.<p> * * @param cms the current OpenCms user context * @param resourceName the resource to generate the online link for * * @return the online link for the given resource, with full server prefix * * @see #getServerLink(CmsObject, String) */ public String getOnlineLink(CmsObject cms, String resourceName) { return getOnlineLink(cms, resourceName, false); }
/** * @see org.opencms.ui.actions.I_CmsWorkplaceAction#executeAction(org.opencms.ui.I_CmsDialogContext) */ public void executeAction(I_CmsDialogContext context) { if (context.getResources().size() == 1) { HttpServletRequest req = CmsVaadinUtils.getRequest(); CmsJspTagEnableAde.removeDirectEditFlagFromSession(req.getSession()); if (context.getCms().getRequestContext().getCurrentProject().isOnlineProject()) { String link = OpenCms.getLinkManager().getOnlineLink( context.getCms(), context.getCms().getSitePath(context.getResources().get(0))); A_CmsUI.get().openPageOrWarn(link, ONLINE_WINDOW_NAME); } else { String link = OpenCms.getLinkManager().substituteLink(context.getCms(), context.getResources().get(0)); A_CmsUI.get().getPage().setLocation(link); } } }
if (CmsLinkManager.isWorkplaceUri(uri)) { return null; || targetMatcher.equals(cms.getRequestContext().getRequestMatcher())) { path = CmsLinkManager.removeOpenCmsContext(path); boolean isWorkplaceServer = OpenCms.getSiteManager().isWorkplaceRequest(targetMatcher) || targetMatcher.equals(cms.getRequestContext().getRequestMatcher()); path = CmsLinkManager.removeOpenCmsContext(path); absolutePath = CmsLinkManager.getAbsoluteUri(path, cms.getRequestContext().addSiteRoot(basePath)); if (OpenCms.getSiteManager().getSiteRoot(absolutePath) != null) { return absolutePath + suffix; absolutePath = CmsLinkManager.getAbsoluteUri( path, cms.getRequestContext().getSiteRoot() + CmsWorkplace.VFS_PATH_EDITORS); absolutePath = CmsLinkManager.getAbsoluteUri( path, cms.getRequestContext().getSiteRoot() + CmsWorkplace.VFS_PATH_EDITORS + "xmlcontent/");
/** * Returns the perma link for the given resource.<p> * * Like * <code>http://site.enterprise.com:8080/permalink/4b65369f-1266-11db-8360-bf0f6fbae1f8.html</code>.<p> * * @param cms the cms context * @param resourceName the resource to generate the perma link for * * @return the perma link */ public String getPermalink(CmsObject cms, String resourceName) { return getPermalink(cms, resourceName, null); }
String otherRoot = siteManager.getSiteRoot(entry.getValue().getRootPath()); if ((otherRoot != null) && otherRoot.equals(ownRoot)) { String theLink = OpenCms.getLinkManager().substituteLinkForUnknownTarget( cms, cms.getRequestContext().removeSiteRoot(entry.getValue().getRootPath())); OpenCms.getSiteManager().getSiteForSiteRoot(cms.getRequestContext().getSiteRoot()).getUrl())) { if (detailResource != null) { onlineLink = OpenCms.getLinkManager().getOnlineLink( cms, cms.getSitePath(containerPage), false); } else { onlineLink = OpenCms.getLinkManager().getOnlineLink(cms, cms.getSitePath(containerPage));
link = CmsLinkManager.removeOpenCmsContext(link);
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(propPath)) { String candidate = null; boolean isAbsolute = CmsLinkManager.isAbsoluteUri(propPath); if (!isAbsolute) { String base = CmsResource.getFolderPath(filePath); candidate = CmsLinkManager.getAbsoluteUri(filePath, base); } else { candidate = propPath;
: pathWithOptionalParameters; if (isAbsoluteUri(link) && !hasScheme(link)) {
if (CmsLinkManager.isWorkplaceLink(getParamCloseLink())) { frameUri = CmsLinkManager.removeOpenCmsContext(frameUri);
if (isAbsoluteUri(relativeUri)) {
/** * Initialize member variables.<p> */ protected void initMembers() { synchronized (LOCK) { m_resourceInitHandlers = new ArrayList<I_CmsResourceInit>(); m_requestHandlers = new HashMap<String, I_CmsRequestHandler>(); m_systemInfo = new CmsSystemInfo(); m_exportPoints = Collections.emptySet(); m_defaultUsers = new CmsDefaultUsers(); m_localeManager = new CmsLocaleManager(Locale.ENGLISH); m_sessionManager = new CmsSessionManager(); m_runtimeProperties = new Hashtable<Object, Object>(); // the default event manager must be available because the configuration already registers events m_eventManager = new CmsEventManager(); // default link manager is required for test cases m_linkManager = new CmsLinkManager(new CmsDefaultLinkSubstitutionHandler()); } }