However, RFC 2616 has references to where Content-Disposition is discussed (RFC
1806 and 2183. See sections 15.5 and 19.5.1 of RFC 2616.
Craig McClanahan
Jen wrote:
> Thank you for sharing. Where can I find the header
> "Content-Disposition"? It's not on rfc2616 Http/1.1
> Thanks.
>
> --- Chin Cedric Sung Kit <[EMAIL PROTECTED]> wrote:
> > Hope this helps.
> >
> > peace,
> > cedric
> >
> > import java.io.*;
> > import java.sql.*;
> > import java.util.*;
> > import
> > javax.servlet.*;
> > import
> > javax.servlet.http.*;
> >
> > public class
> > FileRetriever extends HttpServlet
> > {
> > public void
> > doGet(HttpServletRequest sReq
> > ,HttpServletResponse sRes)
> > throws
> > IOException,ServletException {
> >
> > //the choise you
> > give on ur HTML page for the
> > file to be downloaded
> >
> > String
> > fileSelected =
> > sReq.getParameter("fileSelected");
> >
> >
> > String xxx =
> > getServletContext().getRealPath("/");
> >
> > /* after executing
> > the above statement the
> > string xxx gives the complete path upto the web
> > server directory.Then I am
> > extending the path by specifying the directory which
> > holds all the downloadable
> > file*/
> >
> > String pathOfFile =
> > xxx +
> > "Downloadablefiles"+"\\" + fileSelected;
> > File F = new
> > File(pathOfFile);
> >
> >
> > sRes.setContentType("application/octet-stream");
> >
> > //the next statement
> > is the most IMPORTANT
> > statement
> >
> >
> > sRes.setHeader("Content-Disposition",
> > "attachment;filename=\"" + fileSelected +"\"");
> > ServletOutputStream
> > out =
> > sRes.getOutputStream();
> > InputStream in =
> > null;
> > try
> > {
> > in = new
> > BufferedInputStream(new
> > FileInputStream(F));
> > int ch;
> > while ((ch =
> > in.read()) !=-1)
> > {
> >
> > out.print((char)ch);
> > }
> > }
> > catch(Exception e)
> > {
> >
> > System.out.println(e.toString());
> > }
> > finally
> > {
> > if (in != null)
> > in.close(); // very
> > important
> > out.close();
> > }
> >
> > System.out.println(fileSelected);
> > }
> > }
> >
> >
> > palurumahesh babu wrote:
> >
> > > sir,
> > > i want to know how to do File Download
> > Programming in
> > > Java Servlets. let me know fast. if you have the
> > URL
> > > of application program , let me know.
> > >
> > > Thanking you,
> > >
> > > yours
> > > mahesh/-
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Yahoo! Mail - Free email you can access from
> > anywhere!
> > > http://mail.yahoo.com/
> > >
> > >
> >
> ___________________________________________________________________________
> > > 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
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Mail - Free email you can access from anywhere!
> http://mail.yahoo.com/
>
> ___________________________________________________________________________
> 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
--
====================
See you at ApacheCon Europe <http://www.apachecon.com>!
Session VS01 (23-Oct 13h00-17h00): Sun Technical Briefing
Session T06 (24-Oct 14h00-15h00): Migrating Apache JServ
Applications to Tomcat
___________________________________________________________________________
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