Java Wiki By Richard Keene

JWiki -- OpenSource Wiki clone written in 100% Java. Originally written by Richard Keene. Used at Pace University http://csis.pace.edu:8099/.

Reprise by JoeBergin. Available at http://csis.pace.edu/~bergin/jwiki/index.html.

I don't believe that I have all changes, but I have a pretty complete version to distribute. There is both a runnable jar file and the sources. I'm also continuing development of this, as I use it extensively.


A Wiki-like package in Java

RichardKeene is developing a Java Wiki-like program. It has several differences.

Pages can be HTML body (see WhyDoesntWikiDoHtml for why this is not necessarily a good thing), Wiki style, raw HTML, or Wiki format. The default is HTML body pages. A HTMLBody page has just the main part of the page in HTML and the preamble and postamble parts are added in. A body page does not have the HTML tag, the HEAD, or BODY tags. These are already in the preamble and postamble parts.

A Raw HTML page is an entire normal html page.

A Wiki style page is of the Wiki format and is processed as such.

The files are stored with a HTTP-like header in them. For example the Style: tag tells the style of the page contents. There will be other tags like Creator: LastEditTime?: LastEditWho?: and such. The end of the tags will be a double crlf like in HTTP.

There will be optional login to view, login to edit, locked, and open for each page and a general system default.

There will be transaction locking on edits. If you try to edit a page that is being edited, you will instead get a notice of who is currently editing it and not be allowed to edit it. There will be an edit timeout (half hour?) in case a edit crashes and never finishes. There may also be a force-unlock button.

Systems settings are in a config.ini file.

These differences are intended to make for a more flexible and faster Wiki server. I believe that remembering the ---- is a horizontal line, triple quotes are bold and such is about as difficult as remembering the few simple HTML tags that do the same. This also leaves the HTML syntax wide open for more complex pages. The general how-to-edit philosophy will be to keep things simple so others can easily understand and edit your HTML code.

(Dec 11 1998)

It now has Passwords, Locking, Search, and other features.


(11/23/98) RichardKeene - Got the basic code down over the weekend for GET methods. Next is the POST methods. Also need to change the GET message to parse the header lines of the file. I plan on having the POST methods handled by classes where the POST function is the class name. This way the POST methods are easily extensible.


(11/24/98) JosephKiniry - Another Java-based implementation of Wiki has already been built under the auspices of the DistributedCoalition. It is a distributed component-based architecture based on Java servlets. More information can be found on JikiJikiJava.


Have you thought about using OptimisticLocking instead of blocking edits? -- DaveHarris


Is this still being developed? I had to implement the password file reading feature myself for the latest version. -- JasonYip


It is available on my Web page. It is very much on purpose that it is simple and lightweight. It can run stand-alone. -- RichardKeene


If available, please leave a link to a JavaWikiBasedForum?. -- FridemarPache


RichardKeene - May 22 2000 - Got an email about how to run JWiki.

try

 java jwiki.JWiki .

Where the last dot is the directory where you want to keep the files.


Tim Smith - November 5, 2004

Above didn't work for me but this did:

  java -jar jwiki.jar .

Note that the default port is 6666.


I found a bug in JWiki that prevents a page larger than 1K from being edited. There are two problems involved. The first is a buffer size of 1K when it should be 32K. The second is that the code only reads once from the input. In reality, HTTP packets arrive 2K at a time, so you have to keep reading until you reach the packet size.

The incorrect code is method handleMessage() of JHandler.java, and the new fragment (with the same comment to help you find it) follows:

        // Read any content if there
        if(contentLength > 0)
        {
            contentLength += 2; // Account for crlf after contents.
            doDebug(1, "The request had content length, " + contentLength);
            int n = 0;
            while ((_in.available() > 0) && (n < contentLength)) {
                n += _in.read(_ioBuf, n, contentLength - n);
                if(n != contentLength)
                {
                    doDebug(1, "Amount of content read did not match content length, (" + n + ")");
                }

doDebug(4, "Read content from browser of: " + new String(_ioBuf, 0, n)); } contentLength = n - 2; }


Dan Hankins


CategoryWikiImplementation


View edit of November 21, 2005 or FindPage with title or text search