File handling in GWT

205 views
Skip to first unread message

Sudesna

unread,
Mar 30, 2007, 9:09:05 AM3/30/07
to Google Web Toolkit
Hi,
Please let me know how are the file handling capabilities of an
application developed using GWT.

Mark Volkmann

unread,
Mar 30, 2007, 9:26:41 AM3/30/07
to Google-We...@googlegroups.com

Local or remote? I don't think you can read from files where the
browser is running, but you could call a remote service that reads a
file on the server and returns data to the client. I'm getting ready
to implement something like that to populate a help dialog.

L Frohman

unread,
Mar 30, 2007, 11:06:36 AM3/30/07
to Google-We...@googlegroups.com
You could also use something like dojo storage (www.dojotoolkit.org),
this is not local file storage, but works the same (read/write access
locally from the browser).

Reinier Zwitserloot

unread,
Mar 30, 2007, 4:47:30 PM3/30/07
to Google Web Toolkit
Javascript is 100% INCAPABLE of accessing local files.

GWT compiles to javascript and thus can't do it either.

It's like asking an iPod to make a phone call. It's physically
impossible.

mP

unread,
Apr 1, 2007, 7:59:16 PM4/1/07
to Google Web Toolkit

On Mar 31, 6:47 am, "Reinier Zwitserloot" <reini...@gmail.com> wrote:
> Javascript is 100% INCAPABLE of accessing local files.
>
> GWT compiles to javascript and thus can't do it either.
>
> It's like asking an iPod to make a phone call. It's physically
> impossible.

Some might argue that the new iphone is just an ipod that can make
phone calls :)

Sudesna

unread,
Apr 2, 2007, 2:08:09 AM4/2/07
to Google Web Toolkit
Thanks for the response. Actually we have a stand alone application in
Java and we wanted to deploy it on the web without getting into the
complexities of Javascript and AJAX. The application reads information
from 3-4 files locally(as of now). As the user proceeds, we write back
certain contents to those files and persist it so that when the user
reloads those files, the changes get reflected accordingly in the
application. And i want to know if we use GWT to develope parts of our
application will it be able to meet our requirements? Please let me
know if the information provided is sufficient and clear. Looking
forward to valuable inputs.

Andre Freller

unread,
Apr 2, 2007, 9:03:53 AM4/2/07
to Google-We...@googlegroups.com

Sudesna,

As Reinier said, you can't access local files in GWT.
But you can in a java Applet. See my post in this list
about using an applet to access local files:

http://groups.google.com/group/Google-Web-Toolkit/browse_frm/thread/f1b1285cec44b1ef/777c0a520bfe8214?lnk=gst&q=jsio&rnum=1#777c0a520bfe8214

Regards,
Freller


On 4/2/07, Sudesna <sudesna....@gmail.com> wrote:
...

phaggood

unread,
Apr 2, 2007, 10:43:18 AM4/2/07
to Google Web Toolkit
Here's a blog entry that seems to answer your question - the solution
uses a Flash feature to write to local storage:

"Local storage of client preferences and data is nothing new but, like
DHTML, is being rediscovered as web applications squeeze as much as
they can out of currently deployed browsers and popular plugins. Just
like other web technologies such as JavaScript and CSS, support for
local data files addressable from a web page varies by browser.
JavaScript libraries such as Dojo Storage abstract each storage method
into a single JavaScript call with appropriate storage based on
available resources (thanks Brad Neuberg!), but it's useful to take a
look at the low-level options and their respective limitations"

http://www.niallkennedy.com/blog/archives/2007/01/ajax-performance-local-storage.html

Reinier Zwitserloot

unread,
Apr 2, 2007, 11:22:55 AM4/2/07
to Google Web Toolkit
1. firefox 3.0 has local storage features.
2. you can stuff up to about 4k of encoded data into a cookie before
webbrowsers refuse to store it
3. you can use a flash dot (a 1x1 flash file that's just a container
for some actionscripts), which can offer up to 10MB of storage, though
the user will have to confirm data use once (first time your app saves
something) if you need more than 100k out it.
4. you can use an applet... but if you're going to presume applets you
might as well write the whole thing as an applet, no? Also, applets
STILL can't access files, they only offer the same thing as the flash
device: A storage space.

Generally speaking, the act of porting a java app over to a webpage
using GWT is NOT easy. There are alternatives you should probably be
looking at; a couple of GWT-like projects out there make the browser
really look like a java app (including swing-like boxes and such).
This will be rather off-putting to someone expecting a web page but
it'll probably be way less effort, those toolkits are designed to be
used to port apps like that.

Andre Freller

unread,
Apr 2, 2007, 12:35:13 PM4/2/07
to Google-We...@googlegroups.com

Reinier, that is no correct. A signed applet has full functionality including read/write local files and downloading/uploading to other sites.

Regards,
Freller

Reinier Zwitserloot

unread,
Apr 2, 2007, 7:43:37 PM4/2/07
to Google Web Toolkit
Well, a signed, confirmed applet, yes. But in practice people don't
like them. I don't mind them, they just don't catch on.

On Apr 2, 6:35 pm, "Andre Freller" <andre.frel...@gmail.com> wrote:
> Reinier, that is no correct. A signed applet has full functionality
> including read/write local files and downloading/uploading to other sites.
>
> Regards,
> Freller
>

phaggood

unread,
Apr 2, 2007, 8:05:22 PM4/2/07
to Google Web Toolkit
> here are alternatives you should probably be
> looking at; a couple of GWT-like projects out there make the browser
> really look like a java app (including swing-like boxes and such).

Such as...?

Sudesna

unread,
Apr 3, 2007, 12:04:10 AM4/3/07
to Google Web Toolkit
Thanks for all the responses. I would like to repeat Patrick's
question

Further, can anyone suggest me the best means to convert a stand alone
Java based application to Web based application. Our stand alone Java
application involves File Handling, numerous Event Listeners, Tree
structures, tab controls etc. In future we also plan to use databse.


Looking forward to valuable inputs.

Reinier Zwitserloot

unread,
Apr 3, 2007, 3:05:38 PM4/3/07
to Google Web Toolkit
You can try and run GWT on top of Adobe Apollo, which gives you disk
access amongst other things.

There's an SWT for javascript out there, which can be googled.

I remember seeing something similar for swing, but I can't find it.

Reply all
Reply to author
Forward
0 new messages