title: how to get file name from the server request?
body: <p>I'm trying http requests and create http get request to server. Server must return .zip file. here is the code:</p>
  
  <pre><code>        url = new URL(urlToRead);
          conn = (HttpURLConnection) url.openConnection();
          conn.setRequestMethod("GET");
          is = conn.getInputStream();
  </code></pre>
  
  <p>then I want to write it to file like this:</p>
  
  <pre><code>    r = 1;
      while(r &gt; 0){
       r = is.read(buf);
       if(r &gt; 0)
      fos.write(buf, 0, r);
     }
  </code></pre>
  
  <p>but to create fileoutputstream i want to use the file name provided by server. I've found that server answer has the file name and all the structure looks like this:</p>
  
  <pre><code>HTTP/1.1 200 OK
  Date: Mon, 07 Apr 2003 14:51:19 GMT
  Server: Apache/1.3.20 (Win32) PHP/4.3.0
  Last-Modified: Mon, 07 Apr 2003 14:51:00 GMT
  Accept-Ranges: bytes
  Content-Length: 673
  Keep-Alive: timeout=15, max=100
  Connection: Keep-Alive
  Content-Type: application/zip
  Content-Disposition: attachment; filename=test.zip
  Pragma: no-cache
  
  ....(zip content)
  </code></pre>
  
  <p>how to get filename?</p>