How can I create save destination chooser of file with GWT? - gwt

I want to enhance this question. How can I create File Destination Chooser (as like JFileChooser) in GWT?
I had googled for a long time to get it in GWT. I found GWT FileUpload in most.
Any Suggestions for it ?

UPDATE: After clearing on question
Well, for this you would need a Download Servlet for the file. There in HttpServletResponse you will fill the content with the file and header with file types and all.
And from your client side call the URL.
For prompting case, it depends upon the browser configuration. You cannot force browser to open location prompt.
For achieving download only, you can refer to download file using gwt

Related

How to know whether it is File or a Directory in GWT?

How would I know that it is file or a directory , cause I have to check a condition that if it is a file then return a particular image for the files and if it is directory then return different image for that,
isDirectory() and isFile() method are not working in GWT.
Kindly give the solution for GWT.
Try to use GWT Elemental. It brings a HTML5 File API (besides WebGL, WebAudio, Shadow DOM,...), with which you should check if it is a directory or file (on client-side):
FileEntry fileEntry = (FileEntry)entry;
fileEntry.isDirectory();
fileEntry.isFile();
You should be doing such operations on the server side. You can always create a bean with the required properties which can be used on the client side.

How GWT fileupload works?

Anybody know how GWT file upload works? I know about FileUpload widget and how to use it. I want to know what is its inner mechanism. We can't get contents of file from FileUpload widget in client and how it is going to server? I googled it but i didn't get solution.
Thanks in advance.
GWT's file upload makes use HTML's input element. The html input element is native html dom element which allows to select files from your system.
After selection you need to submit it to your server. This is done by the GWT's FormPanel.
In particular, FileUpload is only useful when used within a FormPanel, because the browser will only upload files using form submission.
Note:
1) You can read about how to code with formpanel and fileupload as answered here # Basic File upload in GWT
2) If you are concerned with processing the file on client side and not pushing the file to server then you have limited options as mentioned here # How to retrieve file from GWT FileUpload component?
formPanel.setAction(GWT.getModuleBaseURL()+"uploadHandler");
formPanel.setMethod(Method.POST);
when we use formPanel.submit(),we can invoke the servlet and get the file upload details.

GWT FileUpload get File Full Path

our Boss wants us to build a client only GWT App. so no server side coding will be involved in our GWT app.
Now we use a FileUpload widget to select a file from user file-system. most Browsers -for security reasons- don't allow FileUpload to return the full path of selected file. a real problem for us!
Is there a way, client-side, to fetch the filepath from a FileUpload widget?
any clever workaround or any other GWT widget that enables user file selection and returns selected file full path in file-system?
thanks.
You cannot get the full path of a selected file of an input element. The path will be absent or changed to avoid security risks in almost every browser browser.
You can get the file's name, and even its content, with the HTML5 FileAPI.

How can I simply add a downloadable PDF file to my page?

I want to add a pdf and word format of my resume to my portfolio page and make it downloadable. Does anyone have some simple script?
Add a link to the file and let the browser handle the download.
You may be over-complicating the problem. It's possible to use a href pointing to the location of the .pdf or .doc file, when a user clicks on this in their browser, generally they will be asked if they would like to save or open the file, depending on their OS/configuration.
If this is still confusing, leave a comment and I'll explain anything you don't get.
Create the PDF. Upload it. Add a link.
Save yourself 30 minutes tossing around with PDFGEN code.
You will want to issue or employ the Content-Disposition HTTP header to force the download otherwise some browsers may recognize the common file extensions and try to automatically open the file contents. It will feel more professional if the link actually downloads the file instead of launching an app - important for a resume I think.
Content-Disposition must be generated within the page from the server side as far as I know.
Option:
Upload your resume to Google Docs.
Add a link to the file on your portfolio page just as I do in the menu of my blog:
Use Google Docs Viewer passing to it the URL of the PDF as you can see in this link.

viewing autocomplete.do files

i was trying to reverse engineer a website ("www.asklaila.com") to find out how their yahoo UI AutoComplete Widget is working. Upon finding the view source of it, i saw it is refering to a file called "/autocomplete.do", i wanted to know what does this autocomplete.do file mean and can i download and open it locally on my machine?
Hope my requisite is legitimate and ethical.
As explained by FileInfo.com, the .do extension represents a server side Java code file that runs on the server and outputs HTML to the response.
Therefore, you cannot download it and view its contents. Any requests to the file will either return the same HTML or an HTTP error if it requires parameters/form fields.