I was just running your program using doGet. It is working fine
even if I changed the name of the file as test.xml. It is working
fine. Go to http://euler.mcs.utulsa.edu:8001/servlet/content
and check it yourself. It is giving the line. I did not understand
what actually you wanted to do. Sometimes browsers have extra
setting for .xml files. I worked with .xml files and sometimes they
show them with the markups in the browser window, sometimes they
show nothing but if you see the source you can see the file is
there. I do not know the answer.
If you want somebody to download a file. You can create a link
with the full servlet execute path as I have given above. And
if they shift+click it should go to download option. I never did
this but it is my intuition that it will work that way.
Sorry I do not knwo any better answer. Wait for somebody else's
response.
(I have to close the 8001 posrt quickly for other work, if you want
you can see now)
Thanks
Sandip
------------------------------------------------------------------------
On Tue, 5 Sep 2000, Partha Bhattacharjee wrote:
> Date: Tue, 5 Sep 2000 12:06:12 +0530
> From: Partha Bhattacharjee <[EMAIL PROTECTED]>
> To: 'Sandip Debnath' <[EMAIL PROTECTED]>
> Subject: RE: Hi, .. .. Partha
>
>
> This is a mail i had posted in the list. Would appreciate if you could do
> anything about it.
>
> ======== message for the list =================
>
> Hi,
>
> I have a servlet that connects to a database, reads it and then creates a
> well formed xml file out of it. Now I have to give users the option of being
> able to download the stuff if they want.
>
> The following code works fine for most of the cases but xml files
>
> import javax.servlet.http.*;
> import javax.servlet.*;
> import java.io.*;
>
> public class content extends HttpServlet
> {
> public void doPost ( HttpServletRequest request, HttpServletResponse
> response )
> throws IOException
> {
>
> response.setHeader ( "content-disposition",
> "attachment;filename=test.txt" ) ;
> PrintWriter out = response.getWriter () ;
> out.println ("<partha></partha>" ) ;
> out.close();
> }
> }
>
> This works fine till the name of the file is test.txt but the moment I make
> it test.xml it gets into some kind of loop and does not download. However
> one can still view it.
>
> As you can see it is a valid xml file and the same code works for all kinds
> of files but xml.
>
> Could anybody out there help? I need it .
>
> brgds
> partha
>
___________________________________________________________________________
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