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?
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.
jk
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/.
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/.