Plugin formating Java source code into syntax highlighted HTML. Source code can be included in the wiki page or referenced from an url.

The plugin can be __downloaded__ from [http://www.java2html.de]. You can also use the jar file attached to this page.

Detailed __installation and usage instructions__ can be found in the [documentation|http://www.java2html.de/docs/wiki/jspwiki.html].

Sample output of the converter is available at [http://www.java2html.de/docs/styles.html] - note that at the moment only the 'Eclipse' style is supported by the plugin.

-- MarkusGebhard, 27-Nov-2003.



!Referencing Attachments

Would be cool to allow that a .java file attached to the page could also be used. For exampe using a protocol type of ''attachment:'' (instead of ''file:''). Like so: __url='attachment:AttachedClass.java'__ 

W/o having looked at ya code, I guess that this functionality can be achieved by a simple transformation. Assuming that {{AttachedClass.java}} is attached to this page you will have to transform {{attachment;AttachedClass.java}} to {{http://www.jspwiki.org/attach?page=Java2HtmlPlugin/AttachedClass.java}} to read the source. 

If you can read from a __file__ URI, your code should be able to also read from a __http__ URI, not? Well, maybe I over-simplify here...

-- TomZ

Of course http URIs are already working.

To reference the attachment is a great idea. But I think rather than providing a different protocol type I will make this a parameter:
  {{Java2HtmlPlugin attachment='AttechedClass.java'}}
Maybe I will also implement both ways. I guess it should not be hard to get the attachment url prefix from the WikiContext?

A new version (also containing more options for the style etc.) will be released next week.

-- MarkusGebhard

The ''parameter'' solution is even ok for me... I am looking forward to the next version. -- TomZ

New release: I have uploaded a new version of the plugin (see attachment).
*supports the option to refer to an attachment (e.g. {{...attachment='HelloWorld.java'...}})
*supports styles (e.g. {{...style='monochrome'...}}, valid styles are Eclipse (default), Monochrome and Kawa)
*boolean flag for rendering a table border ({{...border='true'...}})
*boolean flag for rendering line numbers ({{...lineNumbers='true'...}})

If there are no problems I will release a new official version on my website tomorrow.

BTW: Could this plugin be installed in this wiki? Unfortunately I have no public web server running Tomcat so I cannot demonstrate the features of the plugin :-(


Cool, I will test it tomorrow on my system and provide some feedback here. Concerning the demo, I guess it would be best to send an email directly to Janne asking for it... --TomZ

;:''Sorry guys, anything that allows you to include any file from this server is far, far too dangerous for me to allow on a public wiki.  Cool idea, though. --JanneJalkanen''

Works on:
* Java 1.4.1_02
* Tomcat 4.1.18
* JSPWiki 2.0.52

''Note: For using ''attachments'' I had to set the jspwiki.baseURL property, which is commented out by default.''


Making a http request to get page attachment is a bad idea. 
I protected my wiki with container authorization and getting 401 response 'unauthorized' when the plugin tries to download the attachment.
I modified the plugin so attchment is read from disk by means of AttachmentManager, but this solutions couples tightly with JSPWiki Api and there is no caching.
At least it works.

Please consider resolving this issue. --Mike

!Security Concerns

Many thanks to JanneJalkanen for mentioning security concerns: I almost forgot that.

The new versions have a __security manager__ built in. And here is how it works:
*referencing an url is disabled by default and leads to a PluginException explaining what to do
*referencing a http url can be enabled by adding a property to the {{jspwiki.properties}} file: {{de.java2html.http.url.enabled=true}}
*referencing a file url can be enabled by adding a property to the {{jspwiki.properties}} file: {{de.java2html.file.url.enabled=true}}
*other protocols are not supported
*references to attachments are checked for existence - it will throw a PluginException if the referenced attachment does not exist. So the URL to the attachment should always be valid.

As far as I can see the plugin is now no longer dangerous by default.

!New Releases

2003/12/14: New [version 3.6|http://www.java2html.de] released.--MarkusGebhard

2004/01/05: New [version 4.0|http://www.java2html.de] released.--MarkusGebhard