[jdom-interest] JDOM Closing my Servlet OutputStream
GB/DEV - Philip Nelson
philip.nelson at omniresources.com
Tue Feb 20 05:55:19 PST 2001
There is a FAQ about this I think.
http://www.jdom.org/docs/faq.html
> -----Original Message-----
> From: CND [mailto:admin at brevsville.com.au]
> Sent: Tuesday, February 20, 2001 4:11 AM
> To: jdom-interest at jdom.org
> Subject: [jdom-interest] JDOM Closing my Servlet OutputStream
>
>
> Hi.
>
> I'm new to JDOM and new to XML so I might be missing something obvious
> here.
>
> Whenever I use the DOM/SAX parser withing my Servlet doPost or doGet
> methods, the ServletOutputStream seems to get trashed. For
> example I use
> the code below:
>
> public void doPost(HttpServletRequest req,HttpServletResponse res){
> DOMBuilder b = new DOMBuilder();
> // Create the document
> Document doc = b.build(req.getInputStream());
> Element node = doc.getRootElement();
>
> String bc = node.getChild("Request")
> .getChild("PunchOutSetupRequest")
> .getChild("BuyerCookie").getTextTrim();
>
> res.setContentType("text/plain");
> PrintWriter out = res.getWriter();
> out.println("<html>Hello!</HTML>
> out.flush();
>
> etc...
>
> Nothing gets out of the ServletOutputStream. However if I
> remove the line
> :
>
> Document doc = b.build(req.getInputStream());
>
> Everything works just fine! So clearly something is going
> wrong with the
> "build"....or maybe my mind:)
>
> I have tried getting the printwriter before calling "build" but to no
> avail. I know the parser if working correctly since the Element text
> returned is perfect. If I send my output to the servlet log,
> the output
> is fine. I just can't get anything out of the
> ServletOutputStream. I used
> checkError() and it returns false and the stream is open. I
> ran exactly
> the same code against an xml file in a standard java class
> (not a servlet)
> and it also works fine.
>
> I'm using JDOM-b-6 and tested in Linux and W2K. I also have Jason and
> Craig's Java-XML book but no clues there either.
>
> Help!
>
> Thanx
>
> Chris
>
> PS
> Jason since your Servlet Programming book is so fantastic,
> why not a nice
> XML-Servlet book?
>
>
>
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/yo
uraddr at yourhost.com
More information about the jdom-interest
mailing list