How to read local (Client) file with GWT?

I would like to use GWT to read and parse local csv file.
EDIT: Local file here means client file.

I know I can use HTML5 with javascript to achieve that, but I would like to use GWT to do it.

  • create a text file using javascript
  • Upload a CSV file and read it in Bokeh Web app
  • HTML5 Preview large images quickly
  • Read the contents of a “file” object?
  • can i call one js file from another .
  • How to execute javascript in different file?
  • One way of doing it is by using JavaScript Native Interface (JSNI), however I think it beats the purpose of using GWT.

    Another way of doing this would be upload the file to server, and send it back as a json. But I feel it’s not the best way of doing it.

    Please advise. Thanks.

    EDIT: I intend to design a desktop app, so I try to avoid using any web-server scripting.

  • Formatting text file using jquery
  • createReadStream in Node.JS
  • How can I check existence of a file with JavaScript?
  • why does “HTML file select” changes the order of selected files and sort them alphabetically?
  • how to open a file from a jsp page?
  • Properly Create and Serve PDF Blob via HTML5 File and URL APIs
  • 2 Solutions collect form web for “How to read local (Client) file with GWT?”

    Using jsni doesn’t beat the purpose of gwt, sometimes you need to use it as a wrapper to functionality not yet available in gwt or an external javascript library. Instead of writting jsni access to the file api you can use one of several third party libraries available that implement html5 file access, like

    A quick search returned this SO question: Read text file in google GWT?

    Although GWT doesn’t support, it looks like you could make a request to your CSV File and then parse it.

    Remember that if you will host on AppEngine, you won’t have a filesystem available so you’ll have to have the files hosted elsewhere.