E-Rock
September 23rd, 2003, 02:34 PM
I have some Java code that will transform XML to HTML. The problem is, is that I don't want it to write the results to disk with a FileOutputStream.
What I would really like to do is have the results be streamed right back through the HttpServletResponse. For example:
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<HTML>");
out.println("<HEAD><TITLE>Hello World</TITLE></HEAD>");
out.println("<BODY>");
out.println("<BIG>Hello World</BIG>");
out.println("</BODY></HTML>");
The java code that is doing the transformation is using the javax.xml.transform.Transformer: transform(xmlfile, StreamResult) function.
Is there anyway to tell this function to send the result to the browser directly without creating the file on disk THEN sending it?
Thanks for any info.
E
What I would really like to do is have the results be streamed right back through the HttpServletResponse. For example:
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<HTML>");
out.println("<HEAD><TITLE>Hello World</TITLE></HEAD>");
out.println("<BODY>");
out.println("<BIG>Hello World</BIG>");
out.println("</BODY></HTML>");
The java code that is doing the transformation is using the javax.xml.transform.Transformer: transform(xmlfile, StreamResult) function.
Is there anyway to tell this function to send the result to the browser directly without creating the file on disk THEN sending it?
Thanks for any info.
E