plugins.jasperPluginRMI.writeFile(String, Object) would make it possible to write .jasper files to the application server. Unfortunatly I’m not been able to get this working.
I have a few questions concerning this topic:
- Does this option work at all?
- What is the correct syntax to write a file to the server?
- Is it possible to create a subfolder on the server to save the jasper file into?
Servoy Developer
Version 3.5.5-build 518
Java version 10.0-b23 (Windows 2003)
             
            
              
              
              
            
            
           
          
            
            
              The option should work. Try the next piece of code:
var file = plugins.file.showFileOpenDialog(0, null, false);
if (file!= null)
{
var filecontent = plugins.file.readFile(file);
plugins.jasperPluginRMI.writeFile(‘test.jasper’, filecontent);
}
filecontent variable is a byte object.
The ‘test.jasper’ file is put in the Reports directory as defined in the Preferences. Unfortunately, it does not create subfolders.
If this does not work, please give some more details.
             
            
              
              
              
            
            
           
          
            
            
              
bdiaconescu:
The option should work. Try the next piece of code:
var file = plugins.file.showFileOpenDialog(0, null, false);
if (file!= null)
{
var filecontent = plugins.file.readFile(file);
plugins.jasperPluginRMI.writeFile(‘test.jasper’, filecontent);
}
This sample method does copy the file to the server! Thank you Bogdan!
filecontent variable is a byte object.
Very good.
The ‘test.jasper’ file is put in the Reports directory as defined in the Preferences. Unfortunately, it does not create subfolders.
Creating subfolders would be a nice enhancement to the plug, don’t you think ? ![Wink :wink:]()
             
            
              
              
              
            
            
           
          
            
            
              If you’re interested in adding features to the Jasper Report plugin, feel free to check out the sourcecode at http://code.google.com/p/servoy-jasperreports-plugin/
Subfolder support doesn’t seem to be all that relevant, since the plugin doesn’t support reading the report files from subfolder, if I’m not mistaken.
Paul
             
            
              
              
              
            
            
           
          
            
            
              Thanks for the tip, Paul. We’ll look into that when nessecary.