how to show a file chooser dialog in GWT with server-side file system? - gwt

I have a GWT application, which needs to be configured before it can be used by clients.
I want to show some "perform initial configuration" page and let user select some folder to keep the data in.
now, how do I show a file chooser in the GWT client side which would contain the file system of the server?
I could theoretically implement such a widget myself - read all the files server-side, provide a list to the client, etc, etc. but this looks like a pretty common requirement, so I suspect such a widget should already exist...

GWT does not have an out-of-the-box widget+servlet doing that, and I dont know any 3party library doing that (but maybe you have some success searching in the web).
So you have to create a service in server side to provide the info (folders and files list). In client side I would use a CellTree which is very appropriate to display a filesystem structure.

Related

Sails how to use templates, server side

I have already worked using Sails.js. But in that project we used it simply as an API. We had backbone on a client side.
In the new application I am planning to use Sails from bottom to top, and I have some things I do not fully comprehend.
I have views that use templates (EJS). In my controller I can call a view and pass it a model to render. That I understand. What I am dont fully understand is where do I put javascript files for a client in this scenario?
For example, lets assume that I have a view that has a input box and a button. I would want to have some javascript that controls that button and input (validation or whatever). Lets assume I put that code for input box and button in a validation.js:
1. In what location do I put that file? Assets?
2. How do I include that file to be sent to client for execution? Do I include it in a template.ejs using normal < script > tags?
All the client assets should be placed into the assets folder.
All the includes are automatically binded by Grunt (when lifting the server) into the layout.ejs file, if you've put your css files into the assets/styles folder and your js files into the assets/js folder.

How to present static file results that are generated at different time to client in play 2?

I am writing a web service using play 2.0 in scala.
After getting client's configuration parameters, then the web service will take a while to generate some files. (Note: some files can be short, some other files can take long).
I figured out how to get client's configurations and trigger my computation,
now I need to present the generated files to client side at the end of the session.
So questions are:
How to present the files to client?
I'm thinking about returning a static folder link to client, so that they can go into the folder to
see further what files are there, and so when clicking on the files, the details of the files can be shown, either jpg or text.
But how?
How to not to block client during the generation of the files?
For example, client can still click on the files that are available at that moment.
Then here comes the third question:
How to let the client side know that the long-time computation file is available and listed in the folder?
I'm pretty new to web application, thanks for any suggestion, advice, or little examples are greatly appreciated too!
I would create a web interface to show the created files to your clients and create a background job to for the long computation process. You can create a wait page where a javascript check if the file is created.

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.

Launching a GWT module when clicking on an XML

Greetings,
I'm looking for a way to launch a GWT module when a user clicks on an XML file and have the module consume the xml data. Ideally I would like to render the XML in a rich manner and would prefer to use GWT controls instead of having to lay it out by hand via xslt + javascript.
I'm supposing one way would be to point the xml to a well known xslt that creates a simple html page that forces a redirect to the gwt module but how would I transfer the xml data to said module to allow for enhanced formatting?
Another way would be to have the process that produces the xml also include the bootstrap gwt module but it would be creating multiple bootstrap instances over time and pollute the user's directory.
The use case is that a user would run this app on their local machine which outputs an XML file. If they try and view the xml file in a browser, I'd like to have the GWT module take over and present the data accordingly. I would rather they not have to go to a page and upload the data manually.
Appreciate any ideas on the matter.
TIA
If it's something that runs on the user's machine, I would recommend to ship an executable, or generate a parallel HTML file to present the data. JavaScript run from file:/// will not be able to acces the filesystem.

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.