Managing file in GWT

11 views
Skip to first unread message

bitliner

unread,
Apr 5, 2010, 2:18:06 AM4/5/10
to Google Web Toolkit, bitl...@gmail.com
I'm writing because i have problems with creating files in my gwt
application.

I have read that GWT doesn't support FileOutputStream or other ways to
create file; on web i haven't found any suggestion to resolve this
problem;
and i cannot believe that in my gwt application i cannot create file.

So, can you help me?

Blessed Geek

unread,
Apr 5, 2010, 3:44:14 AM4/5/10
to Google Web Toolkit

FileOutputStream is a Java platform feature.

GWT runtime is not Java platform but javascript platform.

GWT merely uses the Java platform and language to create code native
to the javascript platform. That is whatever GWT source code you are
coding are translated/compiled into javascript and will be run as
javascript on the client browser.

In javascript platform, any legitimate browser would not let web page
use its javascript to access and modify the file system of the
browser's system, whether to read, create, edit, delete or execute.
This security measure is absolute necessity as I will never use a
browser that allow a web page to update stuffs in my PC.

When you say "i cannot believe that in my gwt applicationi cannot
create file", you imply that you cannot believe that a browser's
javascript is not allowed to create a file in the browser's system.
Which in turn implies that you do not agree with the security measures
the browser makers have used to protect you.

On the other hand, what you meant could be that you wish to create a
file on the server rather than the client. In that case, you need
further understanding of the client-server relationships in web
applications. You could have your web page send a request to the
server specifying the URL of the servlet or CGI, so that the servlet
or CGI could in response create that file for you.

GWT allows simplex RPC whereby your web page could communicate with a
servlet or CGI on the server without requiring refresh of the web
page. You should read up on GWT-RPC.

bitliner

unread,
Apr 6, 2010, 1:36:31 PM4/6/10
to Google Web Toolkit
Thannks for the answer.
I understand that GWT is Javascript platoform, and sorry if i have
explained my problem badly.
I wanted to mean creation of my file on the server.
I'm using RPC, but when my java class on the server use
FileOutputStream to create the file
there are problems with this class, FileOutputStream, because it seems
be not supported.
I have also excluded this class from the control of google app, but in
runtime i continue to meet problems.
Some help?

kozura

unread,
Apr 6, 2010, 1:43:01 PM4/6/10
to Google Web Toolkit
Anything in Java can be used on the server side, GWT imposes no
restrictions. However writing a servlet app may require some things
to be done a little different. Check this thread from this morning:
http://groups.google.com/group/google-web-toolkit/browse_thread/thread/05fc009353f8aad2.

jk

Blessed Geek

unread,
Apr 7, 2010, 5:40:40 AM4/7/10
to Google Web Toolkit
Oy, now that is a different issue.
You are using GAE?

If you are developing GWT with no intentions of deploying to Google's
App Engine servers, you should disable GAE option in Eclipse.

Otherwise, if you are developing for deploying on GAE, you have to
realign your programming habits and attitude to use Google's data
repository. Your deployed runtime is not allowed to create files on
Google's servers. All your file outputs should be converted to data
blobs and stored as repository objects. Then, in order for your users
to get a "file" which you created, you need to have a reverse routine
to access that data blob and stream it to the user.

As the story goes, Google has put in a lot of investment to optimise
their distributed data repository. So that someone in China (oops!)
who uses your app and then simultaneously someone in Norway who also
uses your app is able to access the data created by your app in a
consistent manner. This is somewhat called distributed data technology
and perhaps nowadays we could even call it cloudified distributed
data. It does not make sense, at least to me, for Google to
reinvestment another huge effort cloudifying a distributed file
system.

If you do not wish to go thro the tedium of writing your pseudo-file
output stream to the data repository, you should consider Google App
Engine Virtual File System http://code.google.com/p/gaevfs/.

bitliner

unread,
Apr 7, 2010, 10:04:22 AM4/7/10
to Google Web Toolkit
Thanks.
I think to deploy my app on my server, not Google App Engine.
So, as you say, i will disable GAE option and then i will try my
application.
i will try this evening.

Thanks for the answer

regards

On Apr 7, 11:40 am, Blessed Geek <blessedg...@gmail.com> wrote:
> Oy, now that is a different issue.
> You are using GAE?
>
> If you are developing GWT with no intentions of deploying to Google's
> App Engine servers, you should disable GAE option in Eclipse.
>
> Otherwise, if you are developing for deploying on GAE, you have to
> realign your programming habits and attitude to use Google's data
> repository. Your deployed runtime is not allowed to create files on
> Google's servers. All your file outputs should be converted to data
> blobs and stored as repository objects. Then, in order for your users
> to get a "file" which you created, you need to have a reverse routine
> to access that data blob and stream it to the user.
>
> As the story goes, Google has put in a lot of investment to optimise
> their distributed data repository. So that someone in China (oops!)
> who uses your app and then simultaneously someone in Norway who also
> uses your app is able to access the data created by your app in a
> consistent manner. This is somewhat called distributed data technology
> and perhaps nowadays we could even call it cloudified distributed
> data.  It does not make sense, at least to me, for Google to
> reinvestment another huge effort cloudifying a distributed file
> system.
>
> If you do not wish to go thro the tedium of writing your pseudo-file
> output stream to the data repository, you should consider Google App

> Engine Virtual File Systemhttp://code.google.com/p/gaevfs/.

Reply all
Reply to author
Forward
0 new messages