[opencms-dev] How to correctly map /sites/mysite/ ?

Chris Tiernan CTiernan at salesforce.com
Tue Feb 6 21:41:03 CET 2007


It looks like there were a few others out on the web that had the same
problem, but didn't document the solution clearly, so here's what I did
to fix the problem.  If anybody on the list has a better solution please
let me know.

This issue was due to how OpenCms handles URL's, especially after
configuring your site with the nice apache configuration.  Hard coding
the location of your file for use with the <cms:contentload> won't work
on the production server URL since /sites/mysite/ path is removed.

To solve this, I needed to generate the path dynamically...

// create cms object
CmsJspActionElement cms = new CmsJspActionElement(pageContext, request,
response);
// get current folder path
String folderUri = cms.getRequestContext().getFolderUri();
// write result to page context
pageContext.setAttribute("detailFolder", folderUri);

..then write out the pageContext.detailFolder to generate the path for
use with the <cms:contentload> tag...

<cms:contentload
    collector="allInFolderDateReleasedDesc"
    param ${pageContext.detailFolder}myfolder/|mytype|1"
    editable="false"
>

This worked for my offline, online, and production instances.


-----Original Message-----
From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Jonathan Woods
Sent: Tuesday, February 06, 2007 12:29 AM
To: 'The OpenCms mailing list'
Subject: RE: [opencms-dev] How to correctly map /sites/mysite/ ?

I don't use the contentload tag, but a couple of thoughts: (i) do you
need
the /sites/mysite/ prefix in the param attribute value? (ii) does it
help if
you miss off the trailing slash?

Jon 

-----Original Message-----
From: sfdbfoui at host2.scintillance.com
[mailto:sfdbfoui at host2.scintillance.com] On Behalf Of Chris Tiernan
Sent: 06 February 2007 02:14
To: The OpenCms mailing list
Subject: RE: [opencms-dev] How to correctly map /sites/mysite/ ?

I set my log4j.properties to DEBUG to get a better handle on what is
going
on.  It appears that my site template is causing my site to load a 500
server error for the production URL.  Offline and Online sites are
operating
just fine.

My template includes a number of <cms:contentload> tags which can NOT
read
the resource for the defined path (e.g. /sites/mysite/folderA/) for each
content type.  I'm assuming that this is because of the way OpenCms
handles
URL's, so hard coding the folder path isn't going to work.
Setting a property macro doesn't seem to work either since the template
doesn't know what file to pull from. What is the best way to correct
this?

CONTENTLOAD TAG IN TEMPLATE:
<cms:contentload
    collector="allInFolderDateReleasedDesc"
    param="/sites/mysite/folderA/|mytype|1"
    editable="false"
>
...
</cms:contentload>


STACK TRACE:
org.opencms.file.CmsVfsResourceNotFoundException: Error reading resource
from path "/sites/mysite/folderA/".
        at
org.opencms.file.CmsVfsResourceNotFoundException.createException(CmsVfsR
esourceNotFoundException.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:3
830)
        at org.opencms.file.CmsObject.readResource(CmsObject.java:2711)
        at org.opencms.file.CmsObject.readResources(CmsObject.java:2747)
        at
org.opencms.file.collectors.CmsDefaultResourceCollector.allInFolderDateR
eleasedDesc(CmsDefaultResourceCollector.java:220)
        at
org.opencms.file.collectors.CmsDefaultResourceCollector.getResults(CmsDe
faultResourceCollector.java:180)
        at
org.opencms.jsp.CmsJspTagContentLoad.init(CmsJspTagContentLoad.java:868)
        at
org.opencms.jsp.CmsJspTagContentLoad.doStartTag(CmsJspTagContentLoad.jav
a:359)
        at
org.apache.jsp.WEB_002dINF.jsp.online.system.modules.com_salesforce_intr
anet.templates.default_002dtemplate_jsp._jspService(default_002dtemplate
_jsp.java:481)



-----Original Message-----
From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Christian Steinert
Sent: Saturday, February 03, 2007 4:00 AM
To: The OpenCms mailing list
Subject: Re: [opencms-dev] How to correctly map /sites/mysite/ ?

Chris Tiernan schrieb:
> Hi,
>
> Is there a way I can remove /sites/mysite/ from the URL for the Online

> project?  I would like my users to see a URL of
http://domain/index.jsp
> instead of http://domain/sites/mysite/index.jsp
>
> I've tried different variations with the default-uri & uri nodes in
the
> opencms-system.xml file to see if that would help map it correctly but

> with no luck.  Maybe this could be solved with adjusting my Apache 
> configuration?
>
> ## opencms-system.xml ##
> ...
> <sites>
>      <workplace-server>http://domain</workplace-server>
>      <default-uri>/sites/mysite/</default-uri>
>      <site server="http://domain" uri="/sites/mysite/" /> </sites> ...
>   


If you are not logged in and go to http://domain/index.jsp then your
index
page should be found, because the default site uri for http://domain is
set
to /sites/mysite/ and the default URI, too. So when requesting
http://domain/index.jsp, the configuration should be enough so that
opencms
will add the /sites/mysite/ automatically and consequently opencms
should
fetch /sites/mysite/index.jsp from the vfs.

So I don't see how there would be a problem here.

1. Do you really have to go to http://domain/sites/mysite/index.jsp -
even
if you are not logged in?
2. Do you really speak about the online project or do you speak about
static
export?

regards
christian

_______________________________________________
This mail is sent to you from the opencms-dev mailing list To change
your
list options, or to unsubscribe from the list, please visit
http://lists.opencms.org/mailman/listinfo/opencms-dev



_______________________________________________
This mail is sent to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please
visit
http://lists.opencms.org/mailman/listinfo/opencms-dev



More information about the opencms-dev mailing list