title: Delete file when the file downloaded
body: <p>I have to implement a functionality - delete the file on server when user download file is complete. we do not want store that file on server anymore.</p>
  
  <p>I m using struts2 for downloading file on tomcat server. How can i identify file downloading is complete. as of now, i can download file successfully but when the file should be deleted?</p>
  
  <p>code in action class:</p>
  
  <pre><code>contentType=new MimetypesFileTypeMap().getContentType(fileName);
  File f=new File("/home/vikasbarsaiyan/downloadables/"+fileName);
      inputStream = new  FileInputStream(f);
  </code></pre>
  
  <h2>struts.xml</h2>
  
  <pre><code>&lt;action name="downloadFile" class="mypack.action.FileTransferAction"
              method="downloadFile"&gt;
              &lt;result name="success" type="stream"&gt;
               &lt;param name="contentType"&gt;${contentType}&lt;/param&gt;
                  &lt;param name="inputName"&gt;inputStream&lt;/param&gt;
                  &lt;param name="contentDisposition"&gt;filename="${fileName}"&lt;/param&gt;
                  &lt;param name="bufferSize"&gt;4096&lt;/param&gt;
              &lt;/result&gt;
  &lt;/action&gt;
  </code></pre>