How does one use plugins.file.write… in webclient for non-binary output formats e.g. CSV when runReport only ever returns a byte!?
Please see: http://groups.google.com/group/servoy-j … 79eaa2c090
How does one use plugins.file.write… in webclient for non-binary output formats e.g. CSV when runReport only ever returns a byte!?
Please see: http://groups.google.com/group/servoy-j … 79eaa2c090
var bytes = plugin.jasper.runReport();
pluing.file.writeFile(“output.csv”, bytes)
that should work fine except that the mime type is not set right.
For this you can create a case.
if you want to use writeTXTFile(“output.csv”, string)
you first need to create a string from those bytes so you have to know what encoding those bytes do have…
see: public String(byte bytes, int offset, int length, String charsetName) of java.lang.String.
Better would be if the jasper plugin would return a string…
And also for writeTXTFile() we could make an option that you can specify the mime type.
var bytes = plugin.jasper.runReport();
pluing.file.writeFile(“output.csv”, bytes)
In web client this results in a blank window pointing at resources…meaning it doesn’t work.
if you want to use writeTXTFile(“output.csv”, string)
you first need to create a string from those bytes so you have to know what encoding those bytes do have…
see: public String(byte bytes, int offset, int length, String charsetName) of java.lang.String.
I did this originally by using scripting java.lang.String(bytes…) and of course the byte array became a string, but without the mime type everything is text/plain AND the the file gets the suffix .txt. So this doesn’t really work either.
Thank you though for the reply.
In web client this results in a blank window pointing at resources…meaning it doesn’t work.
Did you file a case for this?
i did find the cause of the empty browser window when using writeFile()
Its because for that file the mime type cant be resolved on the server side and then we defaulted to the wrong thing.
I fixed this to just send a null mime type to the browser and the browser will handle it then for you.
But yes better will be if you could specify optionally the mime type you want.
For you second thing that it gets the suffix .txt thats your browser that doesnt happen to me in FF:
plugins.file.writeTXTFile(“output.csv”, “This is a test”);
this will result in a output.csv file with the contenst “this is a test” for me.
But also here it is the same thing as above, it would be nice to be able to optionally set the mime type.
Please do make a case for that (if not done already)
Please do make a case for that (if not done already)
Please see: 284292
Also please see: 284293
Thanks