5 Replies Latest reply on Jun 5, 2014 9:12 PM by Michael Ferrante-Oracle

    Forms 11g webutil show_document issue


      Hi Guys -


      Could you help with the following issue we're having -


      We try to display document on client side, here is the data flow


      1. create the document

      2. use web.show_document to display the document

      3. delete the document


      The issue:

      The code works fine for small document, However, if the document size is big, while show_document is still sending document to client, the delete command got executed and the document got deleted - causing the show document failing.

      If we remove the line that deletes the document - it works fine.


      We tried to put some delays before deleting, it helps, but this is not a solution. I am wondering, is there a way to check if web.show_document has completely finished transmitting document to the client side - and we delete only after that.


      Thanks a lot,


        • 1. Re: Forms 11g webutil show_document issue
          Michael Ferrante-Oracle

          This is somewhat unclear because WEB.SHOW_DOCUMENT does not "send" content to or from the server.  WEB.SHOW_DOCUMENT merely passes a URL to the end-user's default browser.  This is no different from you manually opening a browser and entering a URL.   So, we might need some clarification on what is happening and how you are doing it programmatically.  Since WEB.SHOW is only passing a URL to a browser, the content likely is on a remote server and not the local machine.  Therefore deleting the server side file should be simple, unless it is being locked while the transfer to the browser is occurring.  This would likely be expected behavior.


          If you are trying to use WEB.SHOW to display local content using the file:/// protocol, I do not recommend this nor is it intended use for the Forms WEB.SHOW built-in.  If you need to display local content you should use either a custom Java Bean or Oracle Forms WebUtil.

          1 person found this helpful
          • 2. Re: Forms 11g webutil show_document issue

            What method is using for creating/deleting document?


            is it necessary to delete just after access and download (view) by client?

            if not then schedule the process in OS to delete file periodically after specific time interval.

            1 person found this helpful
            • 3. Re: Forms 11g webutil show_document issue

              Thanks Michael.

              Indeed WEB.SHOW_DOCUMENT merely passes a URL to the end-user's default browser. The part that I am not sure about is this: the URL that show_document sends back to client browser is like this: http://ip:port/forms/configurable path/file-name_1.pdf

              it seems to me a servlet or something on Forms server actually will handle this http request (not sure if this statement is correct), that means in the end Forms server should know the file is being "read" and could set a lock or something to prevent it from being deleted. - especially in our case, our files are created on-fly into a temp folder on the Forms server.




              • 4. Re: Forms 11g webutil show_document issue

                Thanks - we actually are heading toward this direction - however, we consider this as a workaround, and will use it only as last resort - we are still looking for true solution if any.

                • 5. Re: Forms 11g webutil show_document issue
                  Michael Ferrante-Oracle

                  You are requesting files via the web server/listener.  The Forms Servlet is not a player in this process.  So consider that the web server is sending a file and at the same time an external process (your Forms application) is deleting the file being sent by the listener.  Since your Forms app and the web listener don't share this information, neither know what the other is doing.  I suspect you can write a jsp or your own servlet to serve the files and monitor the status of that delivery, but I don't know that all that work is really necessary.  Clearly a longer delay before deleting is needed.


                  When you say that the files are created on the fly, what do you mean?  Are you using Oracle Reports or other engine to do this?  If you are using Oracle Reports, you can configure Reports to delete the files after a specified period of time.  If you are using some other mechanism, then I suggest determine if it has something similar to what Oracle Reports offers.


                  Alternatively, extend the time before deletion or even consider not deleting until the application exits.  By the way, my opinion is that this (my suggestion and what you currently doing)  is not a great way to implement such behavior.  This is especially true if the documents are being deleted for security protection.  What happens if the deletion fails to complete or if the application crashes before deleting?  In this case, the unwanted files would remain on the server and continue to be accessible.


                  A safer approach might be to use WebUtil to download the file to the client machine.  After downloaded, the server copy can be immediately deleted.  Then use WebUtil again to display the document in the associated tool (e.g. Acrobat).  When desired, the client side copy of the file can be deleted programmatically or by the end-user.  This would also eliminate the need to have an additional virtual mapping on the server.