Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Marmotta Wiki" for 
change notification.

The "Customizing" page has been changed by SergioFernandez:
https://wiki.apache.org/marmotta/Customizing?action=diff&rev1=4&rev2=5

Comment:
documenting what's actually required to have MARMOTTA-482 working

   * `rdfhtml.ftl` renders RDF resources as HTML
   * `404.ftl` provides the error page when a requested resources is not found
  
- That would allow advanced users to customize the user interface by directly 
hacking the [[http://freemarker.org|freemarker]] templates. For instance, to 
provide a customized HTML view of the RDF resources. But of course it requires 
to be very careful doing it for not breaking the user interface renderization.
+ That would allow advanced users to customize the user interface by directly 
hacking the [[http://freemarker.org|freemarker]] templates. For instance, to 
provide a customized HTML view of the RDF resources. But of course it requires 
to be very careful doing it for not breaking the templating.
  
+ If you would need to automatically 
[[https://issues.apache.org/jira/browse/MARMOTTA-482|deploy the templates on 
startup]], you can add an event handler like this to your custom application:
+ 
+ {{{
+ public void systemInitialised(@Observes SystemStartupEvent event) {
+     String template = TemplatingService.ERROR_TPL;
+     File templateDir = new File(configurationService.getHome(), 
TemplatingService.PATH);
+     final File tpl = new File(templateDir, template);
+     if (!tpl.exists()) {
+         final InputStream in = this.getClass().getResourceAsStream("/" + 
template);
+         if (in != null) {
+             try {
+                 log.debug("Copying custom template {}", template);
+                 FileUtils.copyInputStreamToFile(in, tpl);
+             } catch (IOException e) {
+                 log.error("Error copying custom template '{}': {}", template, 
e.getMessage());
+             }
+         } else {
+             log.error("Custom template {} not found, so ignoring", template);
+         }
+     }
+ }
+ }}}
+ 

Reply via email to