''This page still under construction''

Current known JSPWiki embedders:

* [Roller Weblogger|http://rollerweblogger.org/wiki/Wiki.jsp?page=RollerWikiPlugin]. [Sample code|http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/roller/roller/src/org/roller/presentation/velocity/plugins/jspwiki/WikiPlugin.java?rev=1.4&content-type=text/vnd.viewcvs-markup]
* [JabberMessageArchiving]

!How does it all work?

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

# __A WikiEngine instance.__  It contains all of the configuration, PageProviders, etc.
# __A WikiContext.__ The WikiContext tells the TranslatorReader things like the current page name, version, stores some WikiVariables, etc.
# __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;
}
}}}
* [netbank|http://netbank.freewebpage.org ]
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.
http://netbank.freewebpage.org
!How do I get a WikiContext

Simple.
{{{
    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 {{java.io.Reader}}.

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

!How can I vary the rendering?

TBA.

!What other information can I get from the TranslatorReader?

TBA.

!What libraries (Jars) do I need?

TBA

!How do I make JSPWiki's logging play nice with my app's Log4j setup?

TBA


;:''BTW, I am not very adept at [log4j] config, so if someone else can help me out here, it would be cool. --[JanneJalkanen].