incubator-jspwiki-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neil Miller <>
Subject Re: Embedding jspwiki in another app
Date Mon, 14 Jan 2008 21:52:26 GMT
Simon Kitching wrote:
> Hi All,
> I'm trying to use jspwiki as the "help engine" for an internal
> application. The intention is that documentors write help for a
> web-application using jspwiki, then we bundle up the pages and include
> them *plus the necessary jspwiki infrastructure to render them* in our
> .war file. Initially it would be view-only, but later we might try to
> implement a custom "page provider" (?) to allow users to modify the
> default pages, with a database used as backing storage.
> I'm just starting on this, and before I spend too much time: has anyone
> done anything similar?
Yes, I have. Not exactly as a help engine, but similar embedding situation.
> The first issue I expect to strike is that the url triggering jspwiki
> will be of form "/ourwebapp/help/Wiki.jsp?page=ZZZ". Does jspwiki run ok
> under a path that is not the webapp root?
I haven't yet tried this under 2.6, but in 2.4 it did not. However it 
wasn't that hard to patch the code to get it working. I have that code 
and could sent it too you, or if Janne thinks it's worth it I could make 
a patch for 2.6 out of it, though that would definitely require some 
clean up, and testing.
> The second issue is that I would really prefer to avoid unpacking the
> jspwiki resource files (jsp, js, images, config-files) into the "main"
> war, such that the files from jspwiki get mingled with the ones for our
> war. That effectively means that I need to get jspwiki running directly
> out of a jarfile without being unpacked. A few things might be
> unavoidable (eg copying tlds into the "real" WEB-INF dir, referencing
> jspwiki servlet-filters from the main web.xml) but getting this even 99%
> working would be great. The main problems appear to be:
> * handling code like "pageContext.forward(someurl)". I don't expect
> servlet engines (and specifically Tomcat 6) will be capable of finding
> jsp files that are within a jarfile. However hopefully pre-compiling the
> jsps will solve that, and the war-tomcat target in the buildfile is a
> good start. I would still need to merge this "web.xml fragment" somehow
> into the main web.xml, but that's not too bad.
> * serving the necessary image and javascript files. It is possible for a
> servlet to catch requests to resources and instead load them from the
> classpath. The Apache Myfaces Tomahawk ExtensionsFilter does this. I
> presume the paths used by jsps to reference them will be relative to the
> webapp root, though, making it difficult to detect which are our
> resources and which are jspwiki ones, plus making name-collisions
> between them possible.
We unpacked and merged. JSPs, javascript, and the like, all went in a 
subdirectory, aka, "/ourwebapp/help/". If you're running read-only you 
really don't need any of that however, as you can write a custom servlet 
that will load the wiki text and pass it to the WikiRenderer to get your 
output HTML (this is a bit of a simplification, but pretty close), then 
all you need is the JAR. We actually did both or the methods described. 
One context was running read-only where the content was displayed in 
pages with tightly integrated L&F, and the other context was an 
administrative one for editing.

View raw message