Closing servlet window after XML download finishes
843841Jul 8 2003 — edited May 9 2008Once the client completes a download of XML info, as provided via the servlet, the browser window remains open. We are wondering if a servlet method in the HTTPServletResponse package will provide this functionality??
It may help to understand how the servlet download is functioning to better answer the question in the previous paragraph. In the "doGet()" method, the following HTTPServletResponse methods are set as shown:
1. The setContentType() method is supplied with an argument value of "application/octet-stream".
2. The setHeader() method's argument values contains the following, "Content-Disposition", "attachment; filename="testXMLFile.xml"".
Since the servlet is instructed not to open the information in standard html format, the browser's download dialog is displayed thereby permitting the client to save the file.
The problem is that once the download save is completed, this "empty" servlet window remains open. We are wondering if the capability exists (possibly from the "Servlet Response" package) to "trap" the download dialog event(s) and a scenario to actually close the window (possibly via Javascript).