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.
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.
Thanks sfr.farhan.fani - 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.
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.