I am having trouble with a servlet in Netscape v 4.76.
I am running Red Hat Linux 7.2.  Thus far I have had
no luck in finding a solution in the archives or
elsewhere.

The servlet (code included below) calls another class
that generates a JPG and outputs it to a file.  A link
to the temporary image file is supposed to be
displayed on the page, but instead I get a pop-up
displaying "The document contains no data".

I have verified that the servlet is generating the
image and placing it in my /tmp folder.  I have also
tested it by outputting the image to
$CATALINA_HOME/temp.

Any assistance that you can provide would be greatly
appreciated!!

CODE...

import java.io.*;
import java.text.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

import duke.cgt.bard.apps.SimpleBardApplication;

public class BARD extends HttpServlet {

static final String PATH =
"/home/www/pkg/jakarta-tomcat-4.0.6/temp/";
static String datafile;


public void doBard(String file) {
     String[] temp = new String[6];
     temp[0] = "-d";
     temp[1] = file;
     temp[2] = "-type";
     temp[3] = "ie";
     temp[4] = "-o";
     temp[5] = PATH+"bard.jpg";

     try {
          SimpleBardApplication.main(temp);
     }catch(Exception e) {
          e.printStackTrace();
     }
}


public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
     datafile = request.getParameter("datafile");
     datafile = PATH + datafile;

     PrintWriter out = response.getWriter();

     response.setContentType("text/html");
     response.setHeader("pragma", "no-cache");
     out.println("<html>");
     out.println("<body>");
     out.println("<head>");
     out.println("<title>BARD Demo</title>");
     out.println("</head>");
     out.println("<body bgcolor=\"white\">");
     out.println("<H1>BARD Demo</H1>");
     out.println("This is the image file " +datafile);
     out.println("</body>");
     out.println("</html>");

     this.doBard(datafile);
}

public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
     doGet(request, response);
}
}

Thanks
Rus


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to