I would just like to ask if there is a way to upload files in GWT WITHOUT using the Google App Engine and Apache Commons archives? I've been searching for ways to upload files in GWT but all of the solutions I find all make use of these two. I would just like to know if there is a way, because our app won't work if we use GAE and Apache Commons... Thank you very much!
Yes, the simplest would be (assuming you are saving files to Blobstore):
On GWT side use FileUpload. Here is an example on how to use it.
On GAE side use BlobStore upload handler.
The other option would be to use gwt-upload with GAE upload handler.
GWT does not have such feature. You need to use some existing library or handle multipart form submits by yourself (FileUpload class). There is for example a gwtupload library which I have used and it worked pretty fine (but it is based on commons-upload AFAIR). There are other libs for sure.
http://code.google.com/p/gwtupload/
Related
How can I upload and download images with spark as our web layer?
I found this example but it heavily relies on Jetty being the container and does not work for Tomcat.
Would love to see a full example.
Why not just use a standard servlet with built in functionality?
Sample Spark Servlet Here
Sample Java Code Here
I'm searching for some good tutorials about implementations of uploading and downloading files (of different kind) in Java web services. I'd like to use latest Spring (core, context, web, webmvc), because I'm not into 'playing' with *.xml configuration files all the time ;). Unfortunately I managed to find only examples with writing own servlets. I’ve been told that easiest way for uploading is to use apache commons upload. Still I don't know an easy way for downloading.
I'd appreciate some example code or links to tutorials that would help. Thanks in advance :)
Let me google that for you "spring webservice upload file"
http://ltalbot.wordpress.com/2010/04/21/file-upload-using-rest-spring-mvc/
Is there any way to implement write/read file with gwt on client-side?
I tried with java.io.File, java.io.Writer ... I couldn't succeed.
thx in advance!
Update: Please see my own answer for a solution
No, you can't write to files on the client-side. GWT only binds a subset of the Java language. Any file IO would need to happen on the server side through RPCs or some kind of web service.
It's possible with HTML5 in some modern browsers. Try lib-gwt-file. This library can read files from client computer and even supports DND. To see it in action follow this link.
More information on HTML5 FileAPI you can find in the specification.
To download a file from browser memory to the client computer you can use Data URI. Example is here. But this feature is supported by Google Chrome only. Also take a look at the following helpful function. It runs download without reloading current page:
public static native void setWindowHref(String url)/*-{
$wnd.location.href = url;
}-*/;
Another semi-crossbrowser way is Downloadify. It's based on flash. Check this example.
Recently, I've stumbled upon a library called client-io.
A simple library that brings the Flash File API to regular web apps
through GWT. ClientIO will help you offload some of the file
generation functionalities to the client, saving resources and heavy
computation to the server. Working Demo - http://ahome-it.github.io/ahome-client-io/
In GWT the classes in the client folder are only compiled into javascript hence it is not possible to use
java.io
since GWT does not provide compilation of the package
java.io
Hence you have to write text file through RPC only.
I want to upload multiple files using java: are there any articles on the subject?
Here's an excellent Java applet for uploading multiple files, including full source:
http://sourceforge.net/projects/jupload/
Your question is not clear. If you mean using Javascript then you can use libraries like extjs that provide control for multiple uploads
if you use java for web you can use jsp :
http://www.roseindia.net/jsp/file_upload/uploadingMultipleFiles.shtml
Apache MINA has a ftp server written in Java - http://mina.apache.org/ftpserver/ - could easily be used with any ftp client to upload multiple files.
Is it possible to upload single files to the Appengine installation instead of the full project every time. This question is related to the Java version of Appengine.
No, it isn't. However the tool will upload only new/modified files.
You don't have much control over this.
In any case, the files that haven't changed are cloned on the AppEngine side so it won't affect your upload time.
If you are trying to use AppEngine as a repository with "commit" operations, then consider using GoogleCode instead.