At line 1 changed one line |
''This page still under construction'' |
[{TableOfContents}] |
At line 3 changed one line |
Current known JSPWiki embedders: |
!!How does it all work? |
At line 5 removed 4 lines |
* [Roller blogger|http://www.rollerweblogger.org/page/roller/20030528]. [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] |
|
!How does it all work? |
|
At line 15 changed one line |
!How to get a WikiEngine? |
!!How to get a WikiEngine? |
At line 28 changed one line |
Properties properties = new Propeties(); |
Properties properties = new Properties(); |
At line 37 changed one line |
!How do I get a WikiContext |
!!How do I get a WikiContext? |
At line 39 changed one line |
Simple. |
Simple. If you have a HttpServletRequest handy, you can just go |
At line 41 changed one line |
WikiPage page = new WikiPage( "SamplePage" ); |
WikiContext wikiContext = myWikiEngine.createContext( request, WikiContext.VIEW ); |
}}} |
|
Another option is to create one for yourself with: |
|
{{{ |
WikiPage page = myWikiEngine.getPage( "SamplePage" ); |
At line 45 added one line |
wikiContext.setRequestContext( WikiContext.VIEW ); |
At line 45 changed one line |
Alternatively, you can use the {{WikiEngine.getPage( String pagename )}} -method to get the WikiPage. |
Alternatively, you can use the WikiPage constructor -method to get the WikiPage. This is not recommended, however, because using getPage() gives you the benefits of the built-in caches. |
At line 49 changed one line |
!How to use the TranslatorReader? |
!!How to get rendered page data? |
At line 51 changed one line |
After you have the WikiContext, you can simply create a new TranslatorReader by using |
If your page data is stored inside a JSPWiki repository, you can use the JSPWiki rendering code directly via the method ~WikiEngine.getHTML(): |
|
At line 57 added 9 lines |
String rendereddata = myWikiEngine.getHTML( wikiContext, page ); |
}}} |
|
The reason why you need to respecify the WikiPage you want to render is that in some occasions you may want to render a page within the context of another page, for example, the LeftMenu wants the ReferringPagesPlugin to get the referring pages of the page are viewing, not LeftMenu. |
|
!!How to use the TranslatorReader? |
|
If you have just a chunk of WikiMarkup, you don't want to store it in the Wiki page repository, but you want to render it directly. This can be accomplished by directly accessing a TranslatorReader. After you have the WikiContext, you can simply create a new TranslatorReader by using |
{{{ |
At line 61 changed one line |
!How can I vary the rendering? |
%%note |
Note: You will need to call any PageFilters manually, if you are directly accessing the TranslatorReader, as normally this is done by the WikiEngine. |
%% |
At line 63 changed one line |
TBA. |
!!How can I vary the rendering? |
At line 65 changed one line |
!What other information can I get from the TranslatorReader? |
Take a look at the Javadoc of TranslatorReader to get the most up-to-date information, but here are some things you can do. You can control some features by setting variables in the WikiContext before rendering, and some others by directly accessing the TranslatorReader. |
At line 67 changed one line |
TBA. |
!Switching off the plugin rendering |
At line 69 changed one line |
!What libraries (Jars) do I need? |
Say |
{{{ |
wikiContext.setVariable( TranslatorReader.PROP_RUNPLUGINS, "false" ); |
}}} |
At line 89 added 34 lines |
Alternatively, use |
{{{ |
translatorReader.enablePlugins( false ); |
}}} |
|
!Turn off image inlining |
|
No matter what jspwiki.properties says, this turns off any image inlining. |
{{{ |
translatorReader.enableImageInlining( false ); |
}}} |
|
!!What other information can I get from the TranslatorReader? |
|
TranslatorReader has a bunch of places where you can hook. I'm calling them hooks, because, well, I'm an old Amiga guy, and that word just sits better with me than "Listener". (This is a stub, more info needed.) |
|
!Modifying link text |
|
Hook to {{{ addLinkTransmutator() }}} |
|
!Collecting local links |
|
Add a listener with {{{addLocalLinkHook()}}}. |
|
!Collecting external hyperlinks |
|
Add a listener with {{{addExternalLinkHook()}}}. |
|
!Collecting attachment links |
|
Add a listener with {{{addAttachmentLinkHook()}}}. |
|
!!What libraries (Jars) do I need? |
|
At line 124 added 13 lines |
|
!!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].'' |
|
!!!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] |
* [The Ceryle Project|http://purl.org/ceryle/] |