title: Receive audio file with servlet
body: <p>Brief Story:
  I have a Servlet which receives a request (getContentType() = audio/x-wav) that I can't read. I need to read this wave and save it on the server side.</p>
  
  <p>Detailed Story:
  I know nothing about Flex, javascript, PHP and Python, I want to record (from the client side "Browser") a wave file and send it to the server to save it (for further ASR processing). </p>
  
  <p>After some searching I found a library called Wami-Recorder (uses flex and java scrip) which I already used, but it didn't give me any java server side example, it also lacks the documentation so I decided to get my hands dirty to get it working.
  it contains a server side python and PHP example (I will list the PHP one):</p>
  
  <pre><code>&lt;?php    
  # Save the audio to a URL-accessible directory for playback.    
  parse_str($_SERVER['QUERY_STRING'], $params);    
  $name = isset($params['name']) ? $params['name'] : 'output.wav';    
  $content = file_get_contents('php://input');    
  $fh = fopen($name, 'w') or die("can't open file");    
  fwrite($fh, $content);    
  fclose($fh);    
  ?&gt;    
  </code></pre>
  
  <p>A final note is that I am sure if I created a socket server and directed the request to it, I will be able to get the media easily, but I want everything to be handled by the Servlets.</p>