Title | WikiEngineAccessesRDFFilesInconsistently |
Date | 28-Nov-2004 14:41:59 EET |
Version | JSPWiki v2.1.123-cvs |
Submitter | 66.80.8.148 |
Criticality | MediumBug |
Browser version | Firefox |
Status | ClosedBug |
PageProvider used | VersioningFileProvider |
Servlet Container | JBoss-3.2.6 + JBossweb-tomcat50 |
Operating System | Windows XP Pro |
URL | http://www.yourdomainhere.org/somepath/Wiki.jsp?page=Anything![]() |
Java version | j2sdk1.4.2_06 |
The WikiEngine.RSSThread class creates a file using a different algorithm than that which WikiEngine.getGlobalRSSURL() uses to subsequently return the filename.
I use
jspwiki.baseURL=http://www.mydomain.net/wiki/ jspwiki.rss.fileName = mydomain.rdf
and then
- WikiEngine.RSSThread uses m_rootPath + getProperty("jspwiki.rss.fileName") to generate the file.
- WikiEngine.getGlobalRSSURL() uses jspwiki.baseURL + getProperty("jspwiki.rss.fileName") to return URLs for the generated file.
So, if my web context is /FOO then the generated file will always be /FOO/mydomain.rdf and the link shall always point to http://www.mydomain.net/wiki/mydomain.rdf. The file is really at http://www.mydomain.net/mydomain.rdf
, but there isn't any way to fix this from the configuration unless you are willing to forgo either the prefix in the baseURL or RSS generation.
The implied assumption of JSPWiki is that jspwiki.baseURL points to your wiki files (i.e. Wiki.jsp). The implied assumption of getGlobalRSSURL() is that your RSS file is in the same directory as your Wiki.jsp file (i.e. baseURL).
I think that RSSThread should not use m_rootPath. Instead I think it should use m_servletContext.getRealPath((new URL(getBaseURL())).getPath()) + getProperty("jspwiki.rss.fileName") so that both the creation and links are relative to base URL.
Cheers,
Mike mtaylor@no-spam-emeraldcave.net
Fix follows:
OLD CODE:
WikiEngine:1861: File file = new File( m_rootPath, fileName );
NEW CODE:
WikiEngine:1861: java.net.URL baseURL = new java.net.URL(m_baseURL); WikiEngine:1862: File file = new File( m_servletContext.getRealPath(baseURL.getPath()), fileName );
Okay, I see. Your fix requires just a bit of NPE checking (getRealPath() is null, if the application is deployed directly from a WAR file. But then you can't generate the RSS file anyway...), but it should work otherwise.
Uuh. I take back my words. No, this does not work, simply because if the baseURL happens to be www.example.com/FOO, your fix will put the RDF file in www.example.com/FOO/FOO/rss.rdf. And in the typical case, this is exactly the kind of configuration you would use.
I'll have to think more about this. Could you detail your config a bit more? Why is the assumption that the rdf file is in the same directory as Wiki.jsp wrong?
No answer from bug reporter after af very long time, closing.......