• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

Working with file upload on the server using java webservice/front end?  RSS feed

 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've my front end written using HTML/CSS/Javascript. Front end is communicating with the backend(Oracle database) using Java Webservices (Spring boot app).

Situation #1:
User clicks on the `Download` button, using Ajax call, I call my Java webservice, java webservice returns the data in JSON format, I display this data in the UI in tabular format.

Situation #2:
Since the amount of data to be returned is going to be huge, when a user clicks on the download button,I am expecting that the query could take hours or maybe a day to finish. Once the query is finished,I would like to upload the data returned from the webservice in a file at some location on the (RHEL)server so that when user comes back, he/she can click the `Download` button and download the file with huge data in whatever format it was saved (CSV, Excel etc)


Questions:

1) I was reading in another Stack overflow post  here (https://stackoverflow.com/questions/13752984/html5-file-api-downloading-file-from-server-and-saving-it-in-sandbox ) that saving file using FileSystemAPI on Firefox isn't supported. I am wondering if this is even a good solution based on the situation #2 described above?

2)If a webservice keeps on running for a day, isn't it going to time out in few hours? I've a feeling that the approach I've mentioned in Situation #2 above isn't an efficient one.

3) Is there something else that can be done in a more efficient manner to accomplish my task? Probably, some scheduling at database point of view?

4) In Situation #2, since the query is going to take long time, I am also planning to change the display of `Download` button to something "Come Back again". In this scenario, how would I determine that a particular query is going to take long time?


 
Marshal
Posts: 24195
54
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jack Tauson wrote:1) I was reading in another Stack overflow post  here (https://stackoverflow.com/questions/13752984/html5-file-api-downloading-file-from-server-and-saving-it-in-sandbox ) that saving file using FileSystemAPI on Firefox isn't supported. I am wondering if this is even a good solution based on the situation #2 described above?



But your proposal was to create the large slow-to-create file on the server, no? (That's what you should be doing.) Browsers don't come into the picture in that case.

2)If a webservice keeps on running for a day, isn't it going to time out in few hours? I've a feeling that the approach I've mentioned in Situation #2 above isn't an efficient one.

3) Is there something else that can be done in a more efficient manner to accomplish my task? Probably, some scheduling at database point of view?



If there's something which is expecting a response from that web service, then yes, the web service shouldn't run for very long. I believe we discussed that in your other post about JMS.

However if you queue up a few queries which each take a day to run, some people are going to have to wait a week for their answer. You might get some complaints. However your query-processing server could run queries in more than one thread.

4) In Situation #2, since the query is going to take long time, I am also planning to change the display of `Download` button to something "Come Back again". In this scenario, how would I determine that a particular query is going to take long time?



It's probably best to just assume that the query is going to take a long time and design accordingly. That's what I would go with; to know how long a given query is going to take is a question which can't be answered in general.
 
I suggest huckleberry pie. But the only thing on the gluten free menu is this tiny ad:
ScroogeXHTML 8.2 - easy to use RTF to HTML converter library
https://coderanch.com/t/707504/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!