Hi, servlet users:

I have tried to include VTK code (visualization toolkit) into the servlet
which will generate a VRML file, then I want to send this file to the
client. The problem is that what the client received is just a raw ASCII
VRML file (.wrl), but I want to invoke the VRML browser whenever the
client received the VRML file. Following is some of my code. Any
suggestions is greatly appreaciated!

Hanmei

--------------------------------------------------------------------------
      response.setContentType("text/html");
      ServletOutputStream out = response.getOutputStream();

      // Some VTK code here which generates VRML file, i.e. "iso.wrl"


      File file = new File("/servlet", "iso.wrl");
      int size = (int) file.length();
      response.setContentLength(size);

      byte [] buffer = new byte[size];
      FileInputStream in = new FileInputStream(file);
      in.read(buffer);
      out.write(buffer);   // Output the iso.wrl to the client!

___________________________________________________________________________
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

Reply via email to