Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Eclipse Scout download file
Eclipse Scout download file [message #1770284] Wed, 09 August 2017 15:47 Go to next message
Corrado Parisi is currently offline Corrado ParisiFriend
Messages: 32
Registered: September 2016
Member
I have a scout application that provides a download button which calls a function on the server side returning a string which I want to save (download) as a file for every user clicking on that button. What is the best way to do that with the new scout APIs?

Here is a related old forum post from 2012:
https://www.eclipse.org/forums/index.php/t/366585/

[Updated on: Wed, 09 August 2017 15:52]

Report message to a moderator

Re: Eclipse Scout download file [message #1770330 is a reply to message #1770284] Thu, 10 August 2017 05:55 Go to previous messageGo to next message
Matthias OtterbachFriend
Messages: 55
Registered: August 2015
Location: Munich
Member
Downloading a file (actually an arbitrary byte[] array) can be implemented easily, for example you could use the following code:

BinaryResource resource = new BinaryResource("filename.txt", "Hello world".getBytes());
getDesktop().openUri(resource, OpenUriAction.DOWNLOAD);


This codes assumes that it runs within the client package and that a desktop is available, for example I used the code above on a Form. If no getDesktop() method is available you could also try IDesktop.CURRENT.get() instead.
Re: Eclipse Scout download file [message #1770331 is a reply to message #1770330] Thu, 10 August 2017 06:43 Go to previous message
Corrado Parisi is currently offline Corrado ParisiFriend
Messages: 32
Registered: September 2016
Member
Thank you very much, says it all.

Yesterday I found a similar example at looking at the scout widgets example code, where a jpg is stored within a table, that can be downloaded subsequently from there :)

Previous Topic:Most abstract GUI component for us to customize?
Next Topic:How to preload a Scout TablePage?
Goto Forum:
  


Current Time: Tue Apr 23 17:33:30 GMT 2024

Powered by FUDForum. Page generated in 0.03021 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top