/** * Returns the jsp loader instance.<p> * * @return the jsp loader instance */ protected CmsJspLoader getJspLoader() { if (m_jspLoader == null) { try { m_jspLoader = (CmsJspLoader)OpenCms.getResourceManager().getLoader(CmsJspLoader.RESOURCE_LOADER_ID); } catch (ArrayIndexOutOfBoundsException e) { // ignore, loader not configured } } return m_jspLoader; }
/** * Returns the jsp loader instance.<p> * * @return the jsp loader instance */ protected CmsJspLoader getJspLoader() { if (m_jspLoader == null) { try { m_jspLoader = (CmsJspLoader)OpenCms.getResourceManager().getLoader(CmsJspLoader.RESOURCE_LOADER_ID); } catch (ArrayIndexOutOfBoundsException e) { // ignore, loader not configured } } return m_jspLoader; }
/** * @see org.opencms.file.types.A_CmsResourceType#initialize(org.opencms.file.CmsObject) */ @Override public void initialize(CmsObject cms) { super.initialize(cms); try { m_jspLoader = (CmsJspLoader)OpenCms.getResourceManager().getLoader(CmsJspLoader.RESOURCE_LOADER_ID); } catch (ArrayIndexOutOfBoundsException e) { // ignore, loader not configured } }
/** * @see org.opencms.file.types.A_CmsResourceType#initialize(org.opencms.file.CmsObject) */ @Override public void initialize(CmsObject cms) { super.initialize(cms); try { m_jspLoader = (CmsJspLoader)OpenCms.getResourceManager().getLoader(CmsJspLoader.RESOURCE_LOADER_ID); } catch (ArrayIndexOutOfBoundsException e) { // ignore, loader not configured } }
/** * @see org.opencms.file.types.A_CmsResourceType#initialize(org.opencms.file.CmsObject) */ @Override public void initialize(CmsObject cms) { super.initialize(cms); try { m_jspLoader = (CmsJspLoader)OpenCms.getResourceManager().getLoader(CmsJspLoader.RESOURCE_LOADER_ID); } catch (ArrayIndexOutOfBoundsException e) { // ignore, loader not configured } }
/** * @see org.opencms.file.types.A_CmsResourceType#initialize(org.opencms.file.CmsObject) */ @Override public void initialize(CmsObject cms) { super.initialize(cms); try { m_jspLoader = (CmsJspLoader)OpenCms.getResourceManager().getLoader(CmsJspLoader.RESOURCE_LOADER_ID); } catch (ArrayIndexOutOfBoundsException e) { // ignore, loader not configured } }
/** * This method purges the JSP repository dirs, * i.e. it deletes all JSP files that OpenCms has written to the * real FS.<p> * * Obviously this method must be used with caution. * Purpose of this method is to allow * a complete purge of all JSP pages on a machine after * a major update of JSP templates was made.<p> */ private synchronized void purgeJspRepository() { CmsJspLoader cmsJspLoader = (CmsJspLoader)OpenCms.getResourceManager().getLoader( CmsJspLoader.RESOURCE_LOADER_ID); cmsJspLoader.triggerPurge(new Runnable() { @SuppressWarnings("synthetic-access") public void run() { clear(); } }); }
/** * @see org.opencms.loader.A_CmsXmlDocumentLoader#getTemplateLoaderFacade(org.opencms.file.CmsObject, org.opencms.file.CmsResource, javax.servlet.http.HttpServletRequest) */ @Override protected CmsTemplateLoaderFacade getTemplateLoaderFacade( CmsObject cms, CmsResource resource, HttpServletRequest req) throws CmsException { CmsResource template = cms.readFile(TEMPLATE_PATH, CmsResourceFilter.IGNORE_EXPIRATION); return new CmsTemplateLoaderFacade(OpenCms.getResourceManager().getLoader(template), resource, template); }
/** * Returns the loader class instance for a given resource.<p> * * @param resource the resource * @return the appropriate loader class instance * @throws CmsLoaderException if something goes wrong */ public I_CmsResourceLoader getLoader(CmsResource resource) throws CmsLoaderException { return getLoader(getResourceType(resource.getTypeId()).getLoaderId()); }
/** * Returns the loader class instance for a given resource.<p> * * @param resource the resource * @return the appropriate loader class instance * @throws CmsLoaderException if something goes wrong */ public I_CmsResourceLoader getLoader(CmsResource resource) throws CmsLoaderException { return getLoader(getResourceType(resource.getTypeId()).getLoaderId()); }
/** * @see org.opencms.loader.I_CmsResourceLoader#service(org.opencms.file.CmsObject, org.opencms.file.CmsResource, javax.servlet.ServletRequest, javax.servlet.ServletResponse) */ public void service(CmsObject cms, CmsResource resource, ServletRequest req, ServletResponse res) throws IOException, CmsException, ServletException { CmsResource renderer = cms.readResource(RENDER_JSP); I_CmsResourceLoader loader = OpenCms.getResourceManager().getLoader(resource); loader.service(cms, renderer, req, res); }
/** * Returns <code>true</code> in case the given resource is an XML content.<p> * * Internally this checks if the content loader for the given resource is * identical to the XML content loader.<p> * * @param resource the resource to check * * @return <code>true</code> in case the given resource is an XML content * * @since 7.0.2 */ public static boolean isXmlContent(CmsResource resource) { boolean result = false; if (resource != null) { // avoid array index out of bound exception: if (!resource.isFolder()) { try { result = OpenCms.getResourceManager().getLoader(resource) instanceof CmsXmlContentLoader; } catch (CmsLoaderException e) { // result will be false } } } return result; }
/** * @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 ServletException, IOException, CmsException { CmsResource renderer = cms.readResource(RENDER_JSP); I_CmsResourceLoader loader = OpenCms.getResourceManager().getLoader(renderer); ensureElementFormatter(resource, req); return loader.export(cms, renderer, req, res); }
/** * @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 ServletException, IOException, CmsException { CmsResource renderer = cms.readResource(RENDER_JSP); I_CmsResourceLoader loader = OpenCms.getResourceManager().getLoader(renderer); ensureElementFormatter(resource, req); loader.load(cms, renderer, req, res); }
/** * @see org.opencms.loader.I_CmsResourceLoader#dump(org.opencms.file.CmsObject, org.opencms.file.CmsResource, java.lang.String, java.util.Locale, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */ public byte[] dump( CmsObject cms, CmsResource resource, String element, Locale selectedLocale, HttpServletRequest req, HttpServletResponse res) throws CmsException, IOException, ServletException { CmsResource renderer = cms.readResource(RENDER_JSP); I_CmsResourceLoader loader = OpenCms.getResourceManager().getLoader(renderer); ensureElementFormatter(resource, req); return loader.dump(cms, renderer, element, selectedLocale, req, res); }
/** * Loads the requested resource and writes the contents to the response stream.<p> * * @param req the current HTTP request * @param res the current HTTP response * @param cms the current OpenCms user context * @param resource the requested resource * @throws ServletException if something goes wrong * @throws IOException if something goes wrong * @throws CmsException if something goes wrong */ public void loadResource(CmsObject cms, CmsResource resource, HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException, CmsException { res.setContentType(getMimeType(resource.getName(), cms.getRequestContext().getEncoding())); I_CmsResourceLoader loader = getLoader(resource); loader.load(cms, resource, req, res); }
/** * Loads the requested resource and writes the contents to the response stream.<p> * * @param req the current HTTP request * @param res the current HTTP response * @param cms the current OpenCms user context * @param resource the requested resource * @throws ServletException if something goes wrong * @throws IOException if something goes wrong * @throws CmsException if something goes wrong */ public void loadResource(CmsObject cms, CmsResource resource, HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException, CmsException { res.setContentType(getMimeType(resource.getName(), cms.getRequestContext().getEncoding())); I_CmsResourceLoader loader = getLoader(resource); loader.load(cms, resource, req, res); }
/** * Creates a thread that start a new publish job with the given information.<p> * * @param publishEngine the publish engine instance * @param publishJob the publish job to process * * @see org.opencms.publish.CmsPublishManager#getPublishList(org.opencms.file.CmsObject, org.opencms.file.CmsResource, boolean) * @see org.opencms.publish.CmsPublishManager#getPublishList(org.opencms.file.CmsObject) */ protected CmsPublishThread(CmsPublishEngine publishEngine, CmsPublishJobInfoBean publishJob) { super(publishJob.getCmsObject(), Messages.get().getBundle().key(Messages.GUI_PUBLISH_TRHEAD_NAME_0)); m_publishJob = publishJob; m_publishEngine = publishEngine; // if the project to publish is a temporary project if (getCms().getRequestContext().currentProject().getType() == CmsProject.PROJECT_TYPE_TEMPORARY) { // we have to update the user info after publishing m_updateSessionInfo = true; } else { m_updateSessionInfo = false; } try { m_jspLoader = (CmsJspLoader)OpenCms.getResourceManager().getLoader(CmsJspLoader.RESOURCE_LOADER_ID); } catch (ArrayIndexOutOfBoundsException e) { // ignore, loader not configured } }
/** * Creates a thread that start a new publish job with the given information.<p> * * @param publishEngine the publish engine instance * @param publishJob the publish job to process * * @see org.opencms.publish.CmsPublishManager#getPublishList(org.opencms.file.CmsObject, org.opencms.file.CmsResource, boolean) * @see org.opencms.publish.CmsPublishManager#getPublishList(org.opencms.file.CmsObject) */ protected CmsPublishThread(CmsPublishEngine publishEngine, CmsPublishJobInfoBean publishJob) { super(publishJob.getCmsObject(), Messages.get().getBundle().key(Messages.GUI_PUBLISH_TRHEAD_NAME_0)); m_publishJob = publishJob; m_publishEngine = publishEngine; // if the project to publish is a temporary project if (getCms().getRequestContext().getCurrentProject().getType() == CmsProject.PROJECT_TYPE_TEMPORARY) { // we have to update the user info after publishing m_updateSessionInfo = true; } else { m_updateSessionInfo = false; } try { m_jspLoader = (CmsJspLoader)OpenCms.getResourceManager().getLoader(CmsJspLoader.RESOURCE_LOADER_ID); } catch (ArrayIndexOutOfBoundsException e) { // ignore, loader not configured } }
/** * Gets the template context provider for a given path.<p> * * @param cms the current CMS context * @param path the path for which the template context provider should be determined * * @return the template context provider for the given path * * @throws CmsException if something goes wrong */ public I_CmsTemplateContextProvider getTemplateContextProvider(CmsObject cms, String path) throws CmsException { CmsResource resource = cms.readResource(path); I_CmsResourceLoader loader = OpenCms.getResourceManager().getLoader(resource); if (loader instanceof A_CmsXmlDocumentLoader) { String propertyName = ((A_CmsXmlDocumentLoader)loader).getTemplatePropertyDefinition(); List<CmsProperty> properties = cms.readPropertyObjects(resource, true); CmsProperty property = CmsProperty.get(propertyName, properties); if ((property != null) && !property.isNullProperty()) { String propertyValue = property.getValue(); if (CmsTemplateContextManager.hasPropertyPrefix(propertyValue)) { return getTemplateContextProvider(removePropertyPrefix(propertyValue)); } } return null; } else { return null; } }