/** * 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); }
/** * 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 the selected files contentsls as a String.<p> * * @param filename the file to read the contents from * @throws CmsException if something goes wrong * @return the selected files contents */ public String readFileContent(String filename) throws CmsException { filename = CmsLinkManager.getAbsoluteUri( filename, CmsResource.getFolderPath(m_cms.getRequestContext().getUri())); CmsFile file = m_cms.readFile(filename, CmsResourceFilter.IGNORE_EXPIRATION); return new String(file.getContents()); }
/** * @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 selected files contentsls as a String.<p> * * @param filename the file to read the contents from * @throws CmsException if something goes wrong * @return the selected files contents */ public String readFileContent(String filename) throws CmsException { filename = CmsLinkManager.getAbsoluteUri( filename, CmsResource.getFolderPath(m_cms.getRequestContext().getUri())); CmsFile file = m_cms.readFile(filename, CmsResourceFilter.IGNORE_EXPIRATION); return new String(file.getContents()); }
/** * @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())); } }
/** * Replacement for the standard servlet API getRequestDispatcher() method.<p> * * This variation is used if an external file (probably JSP) is dispatched to. * This external file must have a "mirror" version, i.e. a file in the OpenCms VFS * that represents the external file.<p> * * @param vfs_target the OpenCms file that is a "mirror" version of the external file * @param ext_target the external file (outside the OpenCms VFS) * * @return the constructed CmsFlexRequestDispatcher */ public CmsFlexRequestDispatcher getRequestDispatcherToExternal(String vfs_target, String ext_target) { return new CmsFlexRequestDispatcher( m_controller.getTopRequest().getRequestDispatcher(ext_target), CmsLinkManager.getAbsoluteUri(vfs_target, m_controller.getCmsObject().getRequestContext().getUri()), ext_target); }
/** * Replacement for the standard servlet API getRequestDispatcher() method.<p> * * This variation is used if an external file (probably JSP) is dispatched to. * This external file must have a "mirror" version, i.e. a file in the OpenCms VFS * that represents the external file.<p> * * @param vfs_target the OpenCms file that is a "mirror" version of the external file * @param ext_target the external file (outside the OpenCms VFS) * * @return the constructed CmsFlexRequestDispatcher */ public CmsFlexRequestDispatcher getRequestDispatcherToExternal(String vfs_target, String ext_target) { return new CmsFlexRequestDispatcher( m_controller.getTopRequest().getRequestDispatcher(ext_target), CmsLinkManager.getAbsoluteUri(vfs_target, m_controller.getCmsObject().getRequestContext().getUri()), ext_target); }
/** * Converts a relative URI in the OpenCms VFS to an absolute one based on * the location of the currently processed OpenCms URI.<p> * * @param target the relative URI to convert * @return the target URI converted to an absolute one */ public String toAbsolute(String target) { if (isNotInitialized()) { return getMessage(NOT_INITIALIZED); } return CmsLinkManager.getAbsoluteUri(target, getController().getCurrentRequest().getElementUri()); }
/** * Converts a relative URI in the OpenCms VFS to an absolute one based on * the location of the currently processed OpenCms URI.<p> * * @param target the relative URI to convert * @return the target URI converted to an absolute one */ public String toAbsolute(String target) { if (isNotInitialized()) { return getMessage(NOT_INITIALIZED); } return CmsLinkManager.getAbsoluteUri(target, getController().getCurrentRequest().getElementUri()); }
/** * Changes the current folder (i.e. the URI in the VFS).<p> * * @param target the new URI * @throws Exception if something goes wrong * @see org.opencms.file.CmsRequestContext#setUri(String) */ public void cd(String target) throws Exception { String folder = CmsResource.getFolderPath(m_cms.getRequestContext().getUri()); if (!target.endsWith("/")) { target += "/"; } String resolvedTarget = CmsLinkManager.getAbsoluteUri(target, folder); CmsResource res = m_cms.readResource(resolvedTarget); if (!res.isFolder()) { throw new CmsIllegalArgumentException(Messages.get().container(Messages.ERR_NOT_A_FOLDER_1, resolvedTarget)); } m_cms.getRequestContext().setUri(resolvedTarget); System.out.println('\n' + getMessages().key(Messages.GUI_SHELL_CURRENT_FOLDER_1, new Object[] {resolvedTarget})); System.out.println(); }
String jspVfsName = CmsLinkManager.getAbsoluteUri(vfsName, controller.getCurrentRequest().getElementRootPath()); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_UPDATE_JSP_1, jspVfsName));
/** * 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())); }
/** * Constructs a new wrapper layer around an (already wrapped) CmsFlexRequest.<p> * * @param req the request to be wrapped * @param controller the controller to use * @param resource the target resource that has been requested */ CmsFlexRequest(HttpServletRequest req, CmsFlexController controller, String resource) { super(req); m_controller = controller; m_elementUri = CmsLinkManager.getAbsoluteUri(resource, m_controller.getCurrentRequest().getElementUri()); m_elementUriSiteRoot = m_controller.getCurrentRequest().m_elementUriSiteRoot; m_isOnline = m_controller.getCurrentRequest().isOnline(); m_canCache = m_controller.getCurrentRequest().isCacheable(); m_doRecompile = m_controller.getCurrentRequest().isDoRecompile(); m_includeCalls = m_controller.getCurrentRequest().getCmsIncludeCalls(); m_parameters = req.getParameterMap(); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_FLEXREQUEST_REUSING_FLEX_REQUEST_1, m_elementUri)); } }
String jspVfsName = CmsLinkManager.getAbsoluteUri(vfsName, controller.getCurrentRequest().getElementRootPath()); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_UPDATE_JSP_1, jspVfsName));
/** * Changes the current folder (i.e. the URI in the VFS).<p> * * @param target the new URI * @throws Exception if something goes wrong * @see org.opencms.file.CmsRequestContext#setUri(String) */ public void cd(String target) throws Exception { String folder = CmsResource.getFolderPath(m_cms.getRequestContext().getUri()); if (!target.endsWith("/")) { target += "/"; } String resolvedTarget = CmsLinkManager.getAbsoluteUri(target, folder); CmsResource res = m_cms.readResource(resolvedTarget); if (!res.isFolder()) { throw new CmsIllegalArgumentException( Messages.get().container(Messages.ERR_NOT_A_FOLDER_1, resolvedTarget)); } m_cms.getRequestContext().setUri(resolvedTarget); m_shell.getOut().println( '\n' + getMessages().key(Messages.GUI_SHELL_CURRENT_FOLDER_1, new Object[] {resolvedTarget})); m_shell.getOut().println(); }
/** * Constructs a new wrapper layer around an (already wrapped) CmsFlexRequest.<p> * * @param req the request to be wrapped * @param controller the controller to use * @param resource the target resource that has been requested */ CmsFlexRequest(HttpServletRequest req, CmsFlexController controller, String resource) { super(req); m_controller = controller; m_elementUri = CmsLinkManager.getAbsoluteUri(resource, m_controller.getCurrentRequest().getElementUri()); m_elementUriSiteRoot = m_controller.getCurrentRequest().m_elementUriSiteRoot; m_isOnline = m_controller.getCurrentRequest().isOnline(); m_canCache = m_controller.getCurrentRequest().isCacheable(); m_doRecompile = m_controller.getCurrentRequest().isDoRecompile(); m_includeCalls = m_controller.getCurrentRequest().getCmsIncludeCalls(); m_parameters = CmsCollectionsGenericWrapper.map(req.getParameterMap()); m_attributes = CmsRequestUtil.getAtrributeMap(req); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_FLEXREQUEST_REUSING_FLEX_REQUEST_1, m_elementUri)); } }
String finalTarget = CmsLinkManager.getAbsoluteUri(target, CmsResource.getParentFolder(source));
String src = CmsLinkManager.getAbsoluteUri(m_src, controller.getCurrentRequest().getElementUri()); CmsUriSplitter splitSrc = new CmsUriSplitter(src);
m_vfsUri = CmsLinkManager.getAbsoluteUri(action, controller.getCurrentRequest().getElementUri()); m_search = false;