Page 2 of 4

Re: How does streamFilesToServer works ?

PostPosted: Thu Sep 23, 2010 6:00 pm
by ptalbot
Hi Scott,

to create an 'uploads' folder in /server/webapps/ROOT/, the server plugin is relying on a path relative to the executable.

On WIndows/Linux launched from developer, this path resolves correctly, but on Mac OS X, it doesn't since the executable is located in the Servoy.app bundle: Servoy.app/Contents/MacOS so the plugin was falling back to the home of the current user (have a look inside yours, you should have and uploads folder in there with your transferred files).

I have corrected this so that it take the Mac path into account, try the attached jar.

Johan: a patch follows ;)

Re: How does streamFilesToServer works ?

PostPosted: Mon Oct 18, 2010 6:48 pm
by Thunder
Hi Patrick

I am trying to use streaming too, but it seems not to be working on my machine. I need to stream a blob in the database to the desktop of the client. I have tried to do this:

Code: Select all
   var dir = plugins.file.showDirectorySelectDialog();
   if (dir){
         plugins.file.streamFilesFromServer(dir, image);
      
         }


but it simply does nothing..
Is there any documentation other than the sample included in Servoy 5.2?

Thanks

Bevil

Re: How does streamFilesToServer works ?

PostPosted: Mon Oct 18, 2010 8:12 pm
by Harjo
Bevil

this version does not do blobs, only streaming file to/from server file based! (not blob-based)

Re: How does streamFilesToServer works ?

PostPosted: Mon Oct 18, 2010 9:04 pm
by Thunder
Hey Harjo

It ONLY works with files? is there any way to work around it? write a blob to a local server temp file first and stream that? or would that undo the benefit of the streaming plugin?

I am in a desperate situation at the moment... My client's in production system has stopped functioning because the datastream plugin has an error:
Failed: Server returned HTTP response code: 500 for URL:x.x.x.x:8080/servoy-service/StreamServiceServlet/


I have spent all day trying to troubleshoot this, to no avail, it just doesn't work any more. In desperation, I tried to do the streamfilesfromserver thing, but if that is a dead end, I'll have to continue fighting with datastream plugin.

:(

Bevil

Re: How does streamFilesToServer works ?

PostPosted: Mon Oct 18, 2010 9:19 pm
by Harjo
have you contacted IT2BE?

Re: How does streamFilesToServer works ?

PostPosted: Mon Oct 18, 2010 9:23 pm
by ptalbot
Hi Bevil,

Yes, as the name of the plugin implies, it works with files!

Depending on the client, you COULD write a temp file on the server and stream that, but writing a temp file will use a server path if your client is a web client, a batch processor or a headless client, because these ones really run in a process on the server, saving directly from a smart client would defeat the purpose since you would have to stream the data to the server first before being able to stream them to your client! ;)

Just make sure the place your save your temp file is located inside the default folder of the file plugin and then your will be able to stream to your client.

Hope this helps,

Re: How does streamFilesToServer works ?

PostPosted: Mon Oct 18, 2010 9:27 pm
by jcompagner
what are you trying to do here?
Code: Select all
   var dir = plugins.file.showDirectorySelectDialog();
   if (dir){
         plugins.file.streamFilesFromServer(dir, image);
     
         }


first you ask on the client to show the file chooser to select a directory..

then you get that dir and then you ask to stream files from the server, but the first argument should be the file on the server.

but database streaming, we already have that that is just loading in the record and asking for that data. Then servoy will stream that from the db to the client for you.

streaming blobs from the client to the server is also easy to do, first just create a temp file, write it and then stream it.

Re: How does streamFilesToServer works ?

PostPosted: Mon Oct 18, 2010 9:40 pm
by Thunder
Hi Johan

What I am trying to do is stream a file from a blob in the database. I didn't realise that this plugin only deals with files on the server, I misunderstood its purpose.

I originally had the system streaming data directly, but these are 60MB tif files, and as I recall, there was a memory issue (and a database lock up during the delivery of the data) if I simply load it from a blob. Is this no longer a problem in 5.2? (when I did this some years ago, I think it was on Servoy 2.2).

That said, what is the best way to stream data from a blob on the server to a file on the client?

Thanks for getting back to me.

Bevil

Re: How does streamFilesToServer works ?

PostPosted: Tue Oct 19, 2010 10:19 am
by jcompagner
you could also use a headless client for this
just call a method on it that will return the byte[] to the callback method when it is done.

Re: How does streamFilesToServer works ?

PostPosted: Tue Oct 19, 2010 10:50 am
by Marco R.
Hi all!

If I stream a file into the default path(/uploads under ROOT path)all works fine but if I try to configure the destination stream path by servoy admin page then something goes wrong..
The main problem is that if I try to put whatever path into the server plugin property than this property completely disappear..to make it visible again I have to go into servoy.properties and remove the line with the plugin configuration.

I'm in windows environment for now(xp and 7),I've tried with this property value:

"C:\","C:/","/mySubFolderUnderROOT","mySubFolderUnderROOT","\mySubFolderUnderROOT" ,
"/mySubFolderUnderUploads" ,"mySubFolderUnderUploads" ,"\mySubFolderUnderUploads" ,
"uploads\mySubFolder".

So now my question is: Am I making something wrong? Why the servoy server file plugin property disappear if I fill it?

Thanks in advance


Marco

Re: How does streamFilesToServer works ?

PostPosted: Tue Oct 19, 2010 2:02 pm
by ptalbot
Hi Marco,

the fact that the property disappears from the admin page is a known bug that has been fixed and will be available in the next Servoy update.
In the meantime, you can set the path in the servoy.properties file, the bug doesn't affect anything else than the visibility of that property in the admin page, so everything else will work as normal.

Hope this helps,

Re: How does streamFilesToServer works ?

PostPosted: Tue Oct 19, 2010 3:13 pm
by Marco R.
Ok Patrick!

Thanks as always!

For anyone that use the webclient and want know more about the use of UploadData in servoy ,see here: http://forum.servoy.com/viewtopic.php?f=3&t=14920

Re: How does streamFilesToServer works ?

PostPosted: Fri Oct 22, 2010 4:02 pm
by Marco R.
Hi Patrick,


When I specify a destination folder that doesn't exist so the function "streamFilesToServer" will create it!(this is a great thing).
But this not happen into the web client..
So I've try to make it by myself and I with the line code:
Code: Select all
plugins.file.getRemoteFolderContents('/')
I can retrive the remote folder status.
My question is: "createFolder" function works on webClient?If yes: How can I create a remote folder without know the remote file struct?(I don't know for example where servoy installation is put,a good way could be to have something that can give me back the remote path or that point directly on remote home-file-plugin-path).

Off course if exist a way to make the function "streamFilesToServer" to create the remote destination folder as do into the smart client would be better.


Thanks in advance

Marco

Re: How does streamFilesToServer works ?

PostPosted: Fri Oct 22, 2010 4:22 pm
by ptalbot
Marco R. wrote:When I specify a destination folder that doesn't exist so the function "streamFilesToServer" will create it!(this is a great thing).
But this not happen into the web client..

It should work in web client too, if not then there is a bug somewhere.
I will have a look.

Re: How does streamFilesToServer works ?

PostPosted: Fri Oct 22, 2010 5:39 pm
by Marco R.
If can help,the error that I receive is:

Code: Select all
java.io.IOException: Impossibile trovare il percorso specificato


by my translation:
Code: Select all
java.io.IOException: Impossible to find the specified path


If I create the missing folder thant all works fine.


Thanks


Marco