This is version . It is not the current version, and thus it cannot be edited.
[Back to current version]   [Restore this version]
TitleWikiEngineAccessesRDFFilesInconsistently
Date28-Nov-2004 14:41:59 EET
VersionJSPWiki v2.1.123-cvs
Submitter66.80.8.148
CriticalityMediumBug
Browser versionFirefox
StatusOpenBug
PageProvider usedVersioningFileProvider
Servlet ContainerJBoss-3.2.6 + JBossweb-tomcat50
Operating SystemWindows XP Pro
URLhttp://www.yourdomainhere.org/somepath/Wiki.jsp?page=Anything
Java versionj2sdk1.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.

-- JanneJalkanen

Add new attachment

Only authorized users are allowed to upload new attachments.
« This particular version was published on 29-Nov-2004 16:26 by Administrator.