Scott,
You can still put the extra path in the URL, like:
http://....../MyServlet/filename.zip?getFileid=1
Unless you call Request.getExtraPath(), you won't even notice it ;-)
[]'s
Rog�rio Gatto
Scott Neufeld wrote:
>
> That could work in certain cases... However, I also have a situation where I'm
> specifying an identifier as opposed to a filename... i.e. I pass
> "MyServlet?getFileid=1", my servlet retrieves the object referenced by "1" in
> the database, and sends it back to the user.
>
> Christopher Goldman wrote:
>
> > Scott,
> >
> > If the URL to your servlet is:
> >
> > http://<server>/DLServlet
> >
> > Then append the name you would like the browsers to use in the file dialog:
> >
> > http://<server>/DLServlet/special.zip
> >
> > This will fool the browsers into presenting 'special.zip' in the 'save
> > as...' dialog. You can search the archive
> > (http://archives.java.sun.com/archives/servlet-interest.html) for previous
> > messages I posted explaining it in more detail.
> >
> > HTH,
> >
> > Chris
> >
> > > -----Original Message-----
> > > From: A mailing list for discussion about Sun Microsystem's Java Servlet
> > > API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Scott
> > > Neufeld
> > > Sent: Tuesday, March 23, 1999 1:10 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: Naming files in Download servlet
> > >
> > >
> > > I'm trying to name a file that is being downloaded via a servlet.
> > > I have done
> > > this:
> > >
> > > response.setContentType(mimeType); // i.e. "application/x-zip-compressed"
> > > response.setHeader("Content-dispostion", "attachment;
> > > filename=\"" + itemName +
> > > "\"");
> > > response.setContentLength(getItem().length) ;
> > > .. then I print it
> > >
> > > The file downloads fine, works and everything, but the filename
> > > is incorrect (it
> > > is still the name of the servlet, although it does append the
> > > suffix of the
> > > filename, i.e. "ServletName.zip").
> > >
> > > Any ideas?
> > >
> > >
> > >
> > > Roger Niederland wrote:
> > >
> > > > Try this:
> > > > ------------
> > > > res.setContentType("application/octet-stream") ;
> > > > res.setHeader("Content-dispostion", "attachment;filename=" +
> > > myfilename ) ;
> > > > res.setContentLength(length) ;
> > > >
> > > > <read file and output the stream of data for browser>
> > > > -------------
> > > >
> > > > -----Original Message-----
> > > > From: Knut Martin Tornes <[EMAIL PROTECTED]>
> > > > To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> > > > Date: Friday, January 01, 1999 12:29 PM
> > > > Subject: Naming files in Download servlet
> > > >
> > > > >Hi folks!
> > > > >
> > > > >I currently have a servlet used to download files from an internal
> > > > >network disk (outside the web server's path). To do this, the servlet
> > > > >opens the file and streams the file as binary data. My problem is to
> > > > >give the stream a name other than the servlet's name. I've tried to set
> > > > >various HTTP header info but without any luck so far.
> > > > >
> > > > >To clarify a little bit: the URL
> > > > >http://my.domain.com:8080/servlet/Download?some_parameter=some_value
> > > > >make Internet Explorer and Netscape (and probably other browsers as
> > > > >well) suggest 'Download.' as the name of the file to download.
> > > > >
> > > > >Any suggestions?
> > > > >
> > > > >thanx in advance,
> > > > >Knut Martin Tornes,
> > > > >objectBOX
> > > > >Norway
> > > > >
> > > >
> > > >=================================================================
> > > ==========
> > > > >To unsubscribe, send email to [EMAIL PROTECTED] and
> > > include in the body
> > > > >of the message "signoff SERVLET-INTEREST".
> > > > >
> > > > >Archives: http://archives.java.sun.com/archives/servlet-interest.html
> > > > >Resources: http://java.sun.com/products/servlet/external-resources.html
> > > > >LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
> > > > >
> > > >
> > > >
> > > ==================================================================
> > > =========
> > > > To unsubscribe, send email to [EMAIL PROTECTED] and include
> > > in the body
> > > > of the message "signoff SERVLET-INTEREST".
> > > >
> > > > Archives: http://archives.java.sun.com/archives/servlet-interest.html
> > > > Resources: http://java.sun.com/products/servlet/external-resources.html
> > > > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
> > >
> > > __________________________________________________________________
> > > _________
> > > To unsubscribe, send email to [EMAIL PROTECTED] and include
> > > in the body
> > > of the message "signoff SERVLET-INTEREST".
> > >
> > > Archives: http://archives.java.sun.com/archives/servlet-interest.html
> > > Resources: http://java.sun.com/products/servlet/external-resources.html
> > > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
> > >
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
begin:vcard
n:Gatto;Rog�rio
tel;fax:+55 19 451 6300
tel;home:+55 19 237 0213
tel;work:+55 19 451 6300
x-mozilla-html:FALSE
url:http://www.widesoft.com.br
org:WideSoft Sistemas Ltda;Development
version:2.1
email;internet:[EMAIL PROTECTED]
title:Systems Analyst
adr;quoted-printable:;;R. Dr. Quirino, 1001 ap 62=0D=0ACentro;Campinas;SP;13015081;Brazil
fn:Rog�rio Meneguelli Gatto
end:vcard