title: JAX-WS MTOM delete attachment after sending to client
body: <p>I am using the reference implementation of JAX-WS with Java 1.6.  On my server I have Web Service method which returns a response with an attachment as a javax.activation.DataHandler.</p>
  
  <pre><code>File myFile = new File("tempFile.txt"); //existing temp file to send back
  DataHandler dh = new DataHandler(new FileDataSource(myFile));
  //cant delete myFile yet, but end of web service method
  </code></pre>
  
  <p>What I need to do is <strong>delete the file after it has been completely sent</strong> from the server to the client. However my webservice method has finished before the response is sent from the client.</p>
  
  <p>What can I do to mark the file for deletion, or is there a callback I can hook into to delete the file after transmission?</p>
  
  <p>thanks</p>