This is version . It is not the current version, and thus it cannot be edited.
[Back to current version]   [Restore this version]

This page still under construction

Current known JSPWiki embedders:

How does it all work?#

To utilize the JSPWiki rendering code (i.e. the TranslatorReader), you need three things:

  1. A WikiEngine instance. It contains all of the configuration, PageProviders, etc.
  2. A WikiContext. The WikiContext tells the TranslatorReader things like the current page name, version, stores some WikiVariables, etc.
  3. A TranslatorReader. This is the heavy lifter that does all of the translating.

How to get a WikiEngine?#

public WikiEngine getEngine( HttpServletRequest request )
    ServletConfig config = request.getSession().getServletContext().getServletConfig();
    WikiEngine my_engine = WikiEngine.getInstance( config );
    return my_engine;

You can instantiate a WikiEngine through

    Properties properties = new Propeties();
    // set properties
    WikiEngine my_engine = new WikiEngine( properties );

but this is not recommended, since WikiEngines should really be singletons across your application (or context - if you have different applications running in the same JVM).

After you have created a WikiEngine, you can then reuse this object all over again. Note that there is a significant penalty in creating a WikiEngine, so you definitely want to cache this object.

How do I get a WikiContext#


    WikiPage page = new WikiPage( "SamplePage" );
    WikiContext wikiContext = new WikiContext( my_engine, page );

Alternatively, you can use the WikiEngine.getPage( String pagename ) -method to get the WikiPage.

The WikiContext holds the current rendering context. The WikiContext is created at the beginning of the request, and discarded after the response has been sent back to the client program. It is probably not a good idea to reuse this object.

How to use the TranslatorReader?#

After you have the WikiContext, you can simply create a new TranslatorReader by using

    TranslatorReader my_reader = new TranslatorReader( wikiContext,
                                                       new StringReader( my_page_data );

Now you can use the TranslatorReader just as if you were using any other

See the FileUtil.copyContents( Reader in, Writer out) if you don't want to copy it all manually.

How can I vary the rendering?#


What other information can I get from the TranslatorReader?#


What libraries (Jars) do I need?#


Add new attachment

Only authorized users are allowed to upload new attachments.
« This particular version was published on 30-May-2003 17:24 by