[opencms-dev] Include body content between sites
Noel Gelineau
ngelineau at greenridge.ca
Wed Apr 12 00:24:58 CEST 2006
Hello,
In 6.0.x, I'm trying to include content (body element) from a page using this code:
<%@ page import="org.opencms.jsp.*" %>
CmsJspActionElement cms = new CmsJspActionElement(pageContext, request, response);
cms.include("/sites/site1/test.html, "body");
This works great when the source and target pages are in the same site, but not when they are in different sites.
For example, page /test.html on site2 tries to grab the body content from /test.html on site1. I set the Workplace Site drop-down to site2 and open /test.html and it doesn't find the page, I basically get:
org.opencms.file.CmsVfsResourceNotFoundException: Error reading resource from path "/sites/site1/test.html".
at org.opencms.file.CmsVfsResourceNotFoundException.createException(CmsVfsResourceNotFoundException.java:78)
at org.opencms.db.CmsDbContext.throwException(CmsDbContext.java:213)
at org.opencms.db.CmsDbContext.report(CmsDbContext.java:197)
at org.opencms.db.CmsSecurityManager.readResource(CmsSecurityManager.java:3838)
at org.opencms.file.CmsObject.readResource(CmsObject.java:2658)
at org.opencms.file.CmsObject.readResource(CmsObject.java:2624)
at com.opencms.legacy.CmsXmlTemplateLoader.includeExtension(CmsXmlTemplateLoader.java:878)
at org.opencms.loader.CmsResourceManager.resolveIncludeExtensions(CmsResourceManager.java:744)
at org.opencms.jsp.CmsJspTagInclude.includeTagAction(CmsJspTagInclude.java:178)
at org.opencms.jsp.CmsJspActionElement.include(CmsJspActionElement.java:384)
at org.opencms.jsp.CmsJspActionElement.include(CmsJspActionElement.java:408)
at org.opencms.jsp.CmsJspActionElement.include(CmsJspActionElement.java:312)
at org.apache.jsp.WEB_002dINF.jsp.offline.system.modules.ca_greenridge_wclc.elements.wclc_005fpage_005fcontent_jsp._jspService(org.apache.jsp.WEB_002dINF.jsp.offline.system.modules.ca_greenridge_wclc.elements.wclc_005fpage_005fcontent_jsp:75)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
at org.opencms.flex.CmsFlexRequestDispatcher.includeExternal(CmsFlexRequestDispatcher.java:193)
at org.opencms.flex.CmsFlexRequestDispatcher.include(CmsFlexRequestDispatcher.java:171)
at org.opencms.loader.CmsJspLoader.service(CmsJspLoader.java:416)
at org.opencms.flex.CmsFlexRequestDispatcher.includeInternalWithCache(CmsFlexRequestDispatcher.java:419)
at org.opencms.flex.CmsFlexRequestDispatcher.include(CmsFlexRequestDispatcher.java:175)
at org.opencms.jsp.CmsJspTagInclude.includeTagAction(CmsJspTagInclude.java:218)
at org.opencms.jsp.CmsJspTagInclude.doEndTag(CmsJspTagInclude.java:349)
at org.apache.jsp.WEB_002dINF.jsp.offline.system.modules.ca_greenridge_wclc_005fab.templates.main_005fwclc_jsp._jspx_meth_cms_include_2(org.apache.jsp.WEB_002dINF.jsp.offline.system.modules.ca_greenridge_wclc_005fab.templates.main_005fwclc_jsp:176)
at org.apache.jsp.WEB_002dINF.jsp.offline.system.modules.ca_greenridge_wclc_005fab.templates.main_005fwclc_jsp._jspService(org.apache.jsp.WEB_002dINF.jsp.offline.system.modules.ca_greenridge_wclc_005fab.templates.main_005fwclc_jsp:73)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
at org.opencms.flex.CmsFlexRequestDispatcher.includeExternal(CmsFlexRequestDispatcher.java:193)
at org.opencms.flex.CmsFlexRequestDispatcher.include(CmsFlexRequestDispatcher.java:171)
at org.opencms.loader.CmsJspLoader.service(CmsJspLoader.java:416)
at org.opencms.flex.CmsFlexRequestDispatcher.includeInternalWithCache(CmsFlexRequestDispatcher.java:419)
at org.opencms.flex.CmsFlexRequestDispatcher.include(CmsFlexRequestDispatcher.java:175)
at org.opencms.loader.CmsJspLoader.dispatchJsp(CmsJspLoader.java:450)
at org.opencms.loader.CmsJspLoader.load(CmsJspLoader.java:395)
at org.opencms.loader.CmsXmlPageLoader.load(CmsXmlPageLoader.java:213)
at org.opencms.loader.CmsResourceManager.loadResource(CmsResourceManager.java:711)
at org.opencms.main.OpenCmsCore.showResource(OpenCmsCore.java:1337)
at org.opencms.main.OpenCmsServlet.doGet(OpenCmsServlet.java:139)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:307)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:385)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:748)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:678)
at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:871)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:534)
Caused by: org.opencms.file.CmsVfsResourceNotFoundException: Unable to read resource "/sites/site1/test.html".
at org.opencms.db.generic.CmsVfsDriver.readResource(CmsVfsDriver.java:1431)
at org.opencms.db.CmsDriverManager.readResource(CmsDriverManager.java:5541)
at org.opencms.db.CmsSecurityManager.readResource(CmsSecurityManager.java:5589)
at org.opencms.db.CmsSecurityManager.readResource(CmsSecurityManager.java:3836)
... 68 more
Note that this also works fine if I set the Workplace sites drop-down to root (/), but regular end-users will not have access to the root site. Is there a way around this?
Thanks,
Noel Gelineau
-------------------------------------------------------------------------------------------------------------------
This communication, including its attachments, if any, is intended solely
for the recipient; it is confidential and may contain personal or private
information, or proprietary and/or privileged material. As such, any
unauthorized use, retention, copying, disclosure or other distribution of
this communication, or the taking of any action in reliance on its contents
is strictly prohibited. If you have received this communication in error,
please notify us immediately and delete this communication (and any
attachments.)
More information about the opencms-dev
mailing list