/** * Returns the CmsObject from the wrapped request.<p> * * This is a convenience method in case you need access to * the CmsObject in your JSP scriplets.<p> * * @return the CmsObject from the wrapped request */ public CmsObject getCmsObject() { if (m_isNotInitialized) { return null; } return m_controller.getCmsObject(); }
/** * Returns the CmsObject from the wrapped request.<p> * * This is a convenience method in case you need access to * the CmsObject in your JSP scriplets.<p> * * @return the CmsObject from the wrapped request */ public CmsObject getCmsObject() { if (m_isNotInitialized) { return null; } return m_controller.getCmsObject(); }
/** * Returns the wrapped CmsObject form the provided request, or <code>null</code> if the * request is not running inside OpenCms.<p> * * @param req the current request * @return the wrapped CmsObject */ public static CmsObject getCmsObject(ServletRequest req) { CmsFlexController controller = (CmsFlexController)req.getAttribute(ATTRIBUTE_NAME); if (controller != null) { return controller.getCmsObject(); } else { return null; } }
/** * Returns the wrapped CmsObject form the provided request, or <code>null</code> if the * request is not running inside OpenCms.<p> * * @param req the current request * @return the wrapped CmsObject */ public static CmsObject getCmsObject(ServletRequest req) { CmsFlexController controller = (CmsFlexController)req.getAttribute(ATTRIBUTE_NAME); if (controller != null) { return controller.getCmsObject(); } else { return null; } }
/** * Returns the current CMS context.<p> * * @return the CMS context */ private CmsObject getCmsObject() { CmsFlexController controller = CmsFlexController.getController(pageContext.getRequest()); return controller.getCmsObject(); }
/** * Returns the full element URI site root path to the resource currently processed.<p> * * @return the name of the resource currently processed */ public String getElementRootPath() { return m_controller.getCmsObject().getRequestContext().addSiteRoot(m_elementUriSiteRoot, m_elementUri); }
/** * Parses all jsp link macros, and replace them by the right target path.<p> * * @param content the content to parse * @param controller the request controller * * @return the parsed content */ protected String parseJspLinkMacros(String content, CmsFlexController controller) { CmsJspLinkMacroResolver macroResolver = new CmsJspLinkMacroResolver(controller.getCmsObject(), null, true); return macroResolver.resolveMacros(content); }
/** * Parses all jsp link macros, and replace them by the right target path.<p> * * @param content the content to parse * @param controller the request controller * * @return the parsed content */ protected String parseJspLinkMacros(String content, CmsFlexController controller) { CmsJspLinkMacroResolver macroResolver = new CmsJspLinkMacroResolver(controller.getCmsObject(), null, true); return macroResolver.resolveMacros(content); }
/** * Returns the full element URI site root path to the resource currently processed.<p> * * @return the name of the resource currently processed */ public String getElementRootPath() { return m_controller.getCmsObject().getRequestContext().addSiteRoot(m_elementUriSiteRoot, m_elementUri); }
/** * @see org.opencms.gwt.I_CmsClientMessageBundle#export(javax.servlet.http.HttpServletRequest) */ public String export(HttpServletRequest request) { CmsObject cms = CmsFlexController.getCmsObject(request); return export(OpenCms.getWorkplaceManager().getWorkplaceLocale(cms)); }
/** * Checks if the provided request is running in OpenCms and the current users project is the online project.<p> * * @param req the current request * * @return <code>true</code> if the request is running in OpenCms and the current users project is * the online project, <code>false</code> otherwise */ public static boolean isCmsOnlineRequest(ServletRequest req) { if (req == null) { return false; } return getController(req).getCmsObject().getRequestContext().getCurrentProject().isOnlineProject(); }
/** * Checks if the provided request is running in OpenCms and the current users project is the online project.<p> * * @param req the current request * * @return <code>true</code> if the request is running in OpenCms and the current users project is * the online project, <code>false</code> otherwise */ public static boolean isCmsOnlineRequest(ServletRequest req) { if (req == null) { return false; } return getController(req).getCmsObject().getRequestContext().currentProject().isOnlineProject(); }
/** * 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); }
/** * Internal action method.<p> * * @param label the label to look up * @param req the current request * @return String the value of the selected label */ public static String wpLabelTagAction(String label, ServletRequest req) { CmsObject cms = CmsFlexController.getCmsObject(req); CmsMessages messages = OpenCms.getWorkplaceManager().getMessages(cms.getRequestContext().getLocale()); return messages.key(label); }
/** * Internal action method.<p> * * @param label the label to look up * @param req the current request * @return String the value of the selected label */ public static String wpLabelTagAction(String label, ServletRequest req) { CmsObject cms = CmsFlexController.getCmsObject(req); CmsMessages messages = OpenCms.getWorkplaceManager().getMessages(cms.getRequestContext().getLocale()); return messages.key(label); }
/** * Returns the jsp resource identified by the given name, using the controllers cms context.<p> * * @param controller the flex controller * @param jspName the name of the jsp * * @return an OpenCms resource * * @throws CmsException if something goes wrong */ protected CmsResource readJspResource(CmsFlexController controller, String jspName) throws CmsException { // create an OpenCms user context that operates in the root site CmsObject cms = OpenCms.initCmsObject(controller.getCmsObject()); // we only need to change the site, but not the project, // since the request has already the right project set cms.getRequestContext().setSiteRoot(""); // try to read the resource return cms.readResource(jspName); }
/** * Fetches the core data.<p> * * @param request the current request * * @return the core data */ public static CmsCoreData prefetch(HttpServletRequest request) { CmsCoreService srv = new CmsCoreService(); srv.setCms(CmsFlexController.getCmsObject(request)); srv.setRequest(request); CmsCoreData result = null; try { result = srv.prefetch(); } finally { srv.clearThreadStorage(); } return result; }
/** * Fetches the dialog data.<p> * * @param request the servlet request * * @return the dialog data * @throws CmsRpcException if something goes wrong */ public static CmsPostUploadDialogBean prefetch(HttpServletRequest request) throws CmsRpcException { CmsPostUploadDialogService srv = new CmsPostUploadDialogService(); srv.setCms(CmsFlexController.getCmsObject(request)); srv.setRequest(request); CmsPostUploadDialogBean result = null; try { result = srv.prefetch(); } finally { srv.clearThreadStorage(); } return result; }
/** * @see org.opencms.workplace.editors.directedit.I_CmsDirectEditProvider#insertDirectEditEmptyList(javax.servlet.jsp.PageContext, org.opencms.workplace.editors.directedit.CmsDirectEditParams) */ public void insertDirectEditEmptyList(PageContext context, CmsDirectEditParams params) throws JspException { insertDirectEditStart(context, params); ServletRequest req = context.getRequest(); CmsFlexController controller = CmsFlexController.getController(req); CmsObject cms = controller.getCmsObject(); print( context, "<div style=\"minHeight:24px\">" + Messages.get().getBundle(OpenCms.getWorkplaceManager().getWorkplaceLocale(cms)).key( Messages.GUI_CLICK_TO_ADD_ELEMENT_TO_EMPTY_LIST_0) + "</div>"); insertDirectEditEnd(context); }