You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Gary Helmling <gh...@panix.com> on 2002/02/04 21:31:28 UTC

Re: populating save as... dialog for application/octet-stream content type (solved maybe)

On Sun, 2002-02-03 at 07:53, rob wrote:
> I tried the following
> 
> request.setHeader("Content-Disposition", "attachment; filename="mypdf.pdf");
> 
> and it seemed to work, is this the correct way or is there a more
> appropriate way to do this?
> 
> Thanks
> 


That is the correct way.  I've had to use a "fake" mime-type to get this
to work with all versions of IE, though (like
"application/x-vnd-yourcompany").  See RFC 2616 for more info:


19.5.1 Content-Disposition
The Content-Disposition response-header field has been proposed as a
means for the origin server to suggest a default filename if the user
requests that the content is saved to a file. This usage is derived from
the definition of Content-Disposition in RFC 1806 [35].

  content-disposition = "Content-Disposition" ":"
                         disposition-type *( ";" disposition-parm )
  disposition-type = "attachment" | disp-extension-token
  disposition-parm = filename-parm | disp-extension-parm
  filename-parm = "filename" "=" quoted-string
  disp-extension-token = token
  disp-extension-parm = token "=" ( token | quoted-string )

An example is
  Content-Disposition: attachment; filename="fname.ext"


--g


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>