/** * 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); }
/** * 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.opencms.ugc.shared.rpc.I_CmsUgcEditService#getLink(java.lang.String) */ public String getLink(String path) { return OpenCms.getLinkManager().substituteLink(getCmsObject(), path); }
/** * Returns the uri (including context path) to the explorer file list.<p> * * @return the uri (including context path) to the explorer file list */ public String getExplorerFileListFullUri() { if (m_file_explorer_filelist != null) { return m_file_explorer_filelist; } synchronized (this) { m_file_explorer_filelist = OpenCms.getLinkManager().substituteLink(getCms(), FILE_EXPLORER_FILELIST); } return m_file_explorer_filelist; }
/** * Returns the uri (including context path) to the explorer file list.<p> * * @return the uri (including context path) to the explorer file list */ public String getExplorerFileListFullUri() { if (m_file_explorer_filelist != null) { return m_file_explorer_filelist; } synchronized (this) { m_file_explorer_filelist = OpenCms.getLinkManager().substituteLink(getCms(), FILE_EXPLORER_FILELIST); } return m_file_explorer_filelist; }
/** * @see org.opencms.loader.I_CmsResourceLoader#export(org.opencms.file.CmsObject, org.opencms.file.CmsResource, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */ public byte[] export(CmsObject cms, CmsResource resource, HttpServletRequest req, HttpServletResponse res) throws IOException, CmsException { String pointer = new String(cms.readFile(resource).getContents()); StringBuffer result = new StringBuffer(128); result.append(EXPORT_PREFIX); if (pointer.indexOf(':') < 0) { result.append(OpenCms.getLinkManager().substituteLink(cms, pointer)); } else { result.append(pointer); } result.append(EXPORT_SUFFIX); load(cms, resource, req, res); return result.toString().getBytes(OpenCms.getSystemInfo().getDefaultEncoding()); }
/** * Redirects the response to the target link.<p> * * Use this method instead of {@link javax.servlet.http.HttpServletResponse#sendRedirect(java.lang.String)} * to avoid relative links with secure sites (and issues with apache).<p> * * @param jsp the OpenCms JSP context * @param target the target link * * @throws IOException if something goes wrong during redirection */ public static void redirectRequestSecure(CmsJspActionElement jsp, String target) throws IOException { jsp.getResponse().sendRedirect(OpenCms.getLinkManager().substituteLink(jsp.getCmsObject(), target, null, true)); }
/** * Redirects the response to the target link.<p> * * Use this method instead of {@link javax.servlet.http.HttpServletResponse#sendRedirect(java.lang.String)} * to avoid relative links with secure sites (and issues with apache).<p> * * @param jsp the OpenCms JSP context * @param target the target link * * @throws IOException if something goes wrong during redirection */ public static void redirectRequestSecure(CmsJspActionElement jsp, String target) throws IOException { jsp.getResponse().sendRedirect(OpenCms.getLinkManager().substituteLink(jsp.getCmsObject(), target, null, true)); }
/** * Redirects the response to the target link using a "301 - Moved Permanently" header.<p> * * This implementation will work only on JSP pages in OpenCms that use the default JSP loader implementation.<p> * * @param jsp the OpenCms JSP context * @param target the target link */ public static void redirectPermanently(CmsJspActionElement jsp, String target) { String newTarget = OpenCms.getLinkManager().substituteLink(jsp.getCmsObject(), target, null, true); jsp.getRequest().setAttribute( CmsRequestUtil.ATTRIBUTE_ERRORCODE, new Integer(HttpServletResponse.SC_MOVED_PERMANENTLY)); jsp.getResponse().setHeader(HEADER_LOCATION, newTarget); jsp.getResponse().setHeader(HEADER_CONNECTION, "close"); }
/** * @see org.opencms.search.solr.I_CmsSolrPostSearchProcessor#process(org.opencms.file.CmsObject, org.opencms.file.CmsResource, org.apache.solr.common.SolrInputDocument) */ public SolrDocument process(CmsObject cms, CmsResource resource, SolrInputDocument document) { document.addField("link", OpenCms.getLinkManager().substituteLink(cms, resource)); return ClientUtils.toSolrDocument(document); }
/** * @see org.opencms.loader.I_CmsResourceLoader#export(org.opencms.file.CmsObject, org.opencms.file.CmsResource, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */ @Override public byte[] export(CmsObject cms, CmsResource resource, HttpServletRequest req, HttpServletResponse res) throws IOException, CmsException { String pointer = new String( cms.readFile(resource).getContents(), CmsLocaleManager.getResourceEncoding(cms, resource)); StringBuffer result = new StringBuffer(128); result.append(EXPORT_PREFIX); // conditionally append parameters of the current request: pointer = appendLinkParams(pointer, req); if (pointer.indexOf(':') < 0) { result.append(OpenCms.getLinkManager().substituteLink(cms, pointer)); } else { result.append(pointer); } result.append(EXPORT_SUFFIX); load(cms, resource, req, res); return result.toString().getBytes(OpenCms.getSystemInfo().getDefaultEncoding()); }
@Override protected String resolveOnClic(Locale locale) { String link = OpenCms.getLinkManager().substituteLink( getCms(), "/system/workplace/commons/publish.jsp?publishProjectId=" + getItem().getId()); return "window.location='" + link + "' + '&closelink='+encodeURI(window.location.href);"; } };
/** * @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())); } }
/** * @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())); } }
/** * @see org.opencms.loader.I_CmsResourceLoader#load(org.opencms.file.CmsObject, org.opencms.file.CmsResource, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */ public void load(CmsObject cms, CmsResource resource, HttpServletRequest req, HttpServletResponse res) throws IOException, CmsException { if ((res == null) || res.isCommitted()) { // nothing we can do return; } String pointer = new String(cms.readFile(resource).getContents()); if (CmsStringUtil.isEmptyOrWhitespaceOnly(pointer)) { throw new CmsLoaderException(Messages.get().container( Messages.ERR_INVALID_POINTER_FILE_1, resource.getName())); } if (pointer.indexOf(':') < 0) { pointer = OpenCms.getLinkManager().substituteLink(cms, pointer); } res.sendRedirect(pointer); }
/** * @see org.opencms.workplace.tools.CmsToolDialog#computeUpLevelLink() */ @Override protected String computeUpLevelLink() { // if adminProject is set, go back to the project file list in the administration String adminProject = getJsp().getRequest().getParameter(CmsToolDialog.PARAM_ADMIN_PROJECT); if ((adminProject != null) && CmsUUID.isValidUUID(adminProject)) { String upLevelLink = OpenCms.getLinkManager().substituteLink( getCms(), "/system/workplace/views/admin/admin-main.jsp") + "?path=%2Fprojects%2Ffiles&action=initial&projectid=" + adminProject; return upLevelLink; } else { return super.computeUpLevelLink(); } }
/** * Opens the page editor for the current site.<p> */ void openPageEditor() { CmsAppWorkplaceUi ui = CmsAppWorkplaceUi.get(); if (ui.beforeViewChange(new ViewChangeEvent(ui.getNavigator(), ui.getCurrentView(), null, APP_ID, null))) { CmsObject cms = A_CmsUI.getCmsObject(); HttpServletRequest req = CmsVaadinUtils.getRequest(); if (req == null) { // called from outside the VAADIN UI, not allowed throw new RuntimeException("Wrong usage, this can not be called from outside a VAADIN UI."); } CmsJspTagEnableAde.removeDirectEditFlagFromSession(req.getSession()); String page = getPath(cms, req.getSession()); if (page != null) { A_CmsUI.get().getPage().setLocation(OpenCms.getLinkManager().substituteLink(cms, page)); } else { String message = CmsVaadinUtils.getMessageText(Messages.GUI_PAGE_EDITOR_NOT_AVAILABLE_0); Notification.show(message, Type.WARNING_MESSAGE); } } }
/** * @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); } } }
/** * Creates a new PDF link object based on the formatter and content resources and the locale of the current CMS context.<p> * * @param cms the current CMS context * @param formatter the formatter resource * @param content the content resource * @throws CmsException if something goes wrong */ public CmsPdfLink(CmsObject cms, CmsResource formatter, CmsResource content) throws CmsException { Locale locale = cms.getRequestContext().getLocale(); m_content = content; m_locale = locale; String detailName = cms.getDetailName( content, cms.getRequestContext().getLocale(), OpenCms.getLocaleManager().getDefaultLocales()); String s = "/" + PDF_LINK_PREFIX + "/" + locale + "/" + formatter.getStructureId() + "/" + detailName + ".pdf"; m_link = OpenCms.getLinkManager().substituteLink(cms, s); }
/** * @see org.opencms.ui.apps.I_CmsWorkplaceApp#onStateChange(java.lang.String) */ public void onStateChange(String state) { // only act on initial state change if (getSource() == null) { CmsWorkplace wp = new CmsWorkplace(A_CmsUI.getCmsObject(), CmsAppWorkplaceUi.get().getHttpSession()) { @Override protected void initWorkplaceRequestValues(CmsWorkplaceSettings settings, HttpServletRequest request) { // nothing to do } }; OpenCms.getWorkplaceManager().getToolManager().setCurrentToolPath(wp, m_toolHandler.getPath()); String url = OpenCms.getLinkManager().substituteLink(A_CmsUI.getCmsObject(), m_toolHandler.getLink()); setSource(new ExternalResource(url)); setSizeFull(); } } }