This discussion is archived
1 2 Previous Next 23 Replies Latest reply: Sep 29, 2012 8:38 PM by 963705 Go to original post RSS
  • 15. Re: How to force browser to open/save/save as the file from server
    963705 Newbie
    Currently Being Moderated
    jtahlborn wrote:
    960702 wrote:
    handat wrote:
    960702 wrote:
    I have already done that. This problem occurs only when user is opening the csv file directly.
    If he uses save as option then it works normally.
    This means the cached version is probably served by your web container's cache in which case you need to disable server side caching. Most web servers have this enabled by default.
    As stated earlier also this happens only when clicking on open button. save as and save are working fine.
    i don't think you answered this question yet. when you see the old file again, does the browser actually make a request to your servlet or not?
    Let me explain the scenario again
    servlet1: takes all inputs from user and sends to servlet2
    servlet2: generates a query based on servlet1's inputs and passes to PL/SQL procedure
    PL/SQL procedure: takes the query from servlet2 and generated a csv file on the server and passes the link of the same to servlet2.
    Servlet2: finally displays the link, for user to download the file.

    Now for a new updated file user has to start from servlet1
    and servlet2 displays the link.
    All response headers are properly set.
    Now as stated earlier things work well till user clicks on save as option.
    Problem arises only when he uses open option.In this case browser instantly opens old file.
    So server side caching is not active other wise even save as would not have worked.
  • 16. Re: How to force browser to open/save/save as the file from server
    darke Explorer
    Currently Being Moderated
    960702 wrote:
    jtahlborn wrote:
    at this point, it sounds like you have a browser specific problem (what version of IE are you testing)? you should definitely try another browser. is the browser actually making the second request to the server? if so, the issue may not be the browser caching, so much as however the file is being saved to disk in order to load is the problem. maybe the file isn't getting overwritten properly. or maybe you aren't refreshing the program you are using to read the file (excel perhaps?).
    Have tried with all versions of IE and it works same.
    First page asks for filter criteria and on the basis the file is generated and link is given to user.
    Now to get different file you have to select different criteria, based on which new file is generated.
    So user has to get to first page to change criteria and get new file.
    And each time I am closing the excel before reopening the new file.
    Still no help.
    Did you verify that the file in your Temporary Internet Files folder is getting overwritten by the new version each time you click on open ?

    If not , check if it's resolved if you can make the file name unique .
  • 17. Re: How to force browser to open/save/save as the file from server
    963705 Newbie
    Currently Being Moderated
    .
    >
    Did you verify that the file in your Temporary Internet Files folder is getting overwritten by the new version each time you click on open ?

    If not , check if it's resolved if you can make the file name unique .
    Making file name unique is what I thought of , however this will create a new file for each request.
    Hence cleaning these files from server will be another issue :(
  • 18. Re: How to force browser to open/save/save as the file from server
    EJP Guru
    Currently Being Moderated
    Not really, just delete them as soon as they have been served.
  • 19. Re: How to force browser to open/save/save as the file from server
    gimbal2 Guru
    Currently Being Moderated
    960702 wrote:
    Making file name unique is what I thought of , however this will create a new file for each request.
    I'd think that would be something you want. If the filenames wouldn't be unique per request, two different requests could trigger the exact same file to be created simultaneously. Woe be you when you create that possibility, it tends to not pop up until 2 years later when you can't possibly explain why anymore.
  • 20. Re: How to force browser to open/save/save as the file from server
    963705 Newbie
    Currently Being Moderated
    EJP wrote:
    Not really, just delete them as soon as they have been served.
    How, as the file is getting created by PL/SQL procedure, and will try to delete from java.
    Security and permissions at different levels required .
    Also tried to delete files through PL?SQL procedure itself(delete all such files created 5 min before as they would have served their purpose by then.)
    However even after taking all relevant permissions it didn't worked.
    (Have a separate thread regarding same )
  • 21. Re: How to force browser to open/save/save as the file from server
    963705 Newbie
    Currently Being Moderated
    gimbal2 wrote:
    960702 wrote:
    Making file name unique is what I thought of , however this will create a new file for each request.
    I'd think that would be something you want. If the filenames wouldn't be unique per request, two different requests could trigger the exact same file to be created simultaneously. Woe be you when you create that possibility, it tends to not pop up until 2 years later when you can't possibly explain why anymore.
    Actually I have limited users for this facility, so files are actually created with their login name.
    So all requests from a login will generate single file , for different logins different file names will be their.
    And login is session managed so no two sessions for same login
    Ultimately one login will have separate file from other one, hence mentioned problem won't arise :)
  • 22. Re: How to force browser to open/save/save as the file from server
    jtahlborn Expert
    Currently Being Moderated
    960702 wrote:
    gimbal2 wrote:
    960702 wrote:
    Making file name unique is what I thought of , however this will create a new file for each request.
    I'd think that would be something you want. If the filenames wouldn't be unique per request, two different requests could trigger the exact same file to be created simultaneously. Woe be you when you create that possibility, it tends to not pop up until 2 years later when you can't possibly explain why anymore.
    Actually I have limited users for this facility, so files are actually created with their login name.
    So all requests from a login will generate single file , for different logins different file names will be their.
    And login is session managed so no two sessions for same login
    Ultimately one login will have separate file from other one, hence mentioned problem won't arise :)
    what about multiple requests from the same user? two different tabs in the browser, or one request interrupted on the network so retried...
  • 23. Re: How to force browser to open/save/save as the file from server
    963705 Newbie
    Currently Being Moderated
    >
    what about multiple requests from the same user? two different tabs in the browser, or one request interrupted on the network so retried...
    As said earlier , have limited users for this facility and that too managers and above(who do not fiddle with system as they are overloaded with work :) ).
    Apart from that the file contains the search criteria details and the data so it gives user a picture of what he can expect.
    Even if user opens 2 tabs and sends 2 different req there will always be a single file containing latest search criteria result.
    And as file contains the search criteria, user can always perform a new search to get desired file :D.
1 2 Previous Next

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points