Fwd: [jdom-interest] SAXBuilder.build() weirdness
John Muhlestein
jmuhlestein at i-link.net
Wed Jul 18 10:04:47 PDT 2001
I do set the Content-length when I POST. I have included the Class which
does the post and the servlet that is calling the class that does the call
to the program that parses the xml. (There is a bunch of debug code in the
files)
thanks,
John
-----Original Message-----
From: Elliotte Rusty Harold [mailto:elharo at metalab.unc.edu]
Sent: Wednesday, July 18, 2001 6:06 AM
To: jdom-interest at jdom.org
Subject: Re: Fwd: [jdom-interest] SAXBuilder.build() weirdness
At 1:44 AM +0100 7/18/01, Bob Tarling wrote:
>
>Basically, as far as I can make out, the problem is that the DOM parser
doesn't always know when a stream coming in through a BufferedReader has
ended. If your reading a file then fine, a file has a definite end. But if
your reading in through a socket it just carries on waiting while the socket
is open as it doesn't know if the client has finished. ..
>
>The attached solution sends the entire XML across the socket as a single
string terminated by a line break. This is then transfered to a StringReader
and the StreamReader can be accepted by the build as the string has a
definite end.
>
No, unless there's something weird going on with servlets specifically
(Jason, comments?) this should not be the problem or the solution. When you
use HTTP POST, you should always include a Content-length MIME header that
specifies the exact number of bytes you're sending in the message body. Once
that number of bytes as been received, the server should indicate end of
stream. If you're not sending a proper content-length header field, then the
client needs to close the connection so the server knows it's done.
--
+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
| The XML Bible, 2nd Edition (Hungry Minds, 2001) |
| http://www.ibiblio.org/xml/books/bible2/ |
| http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/ |
+----------------------------------+---------------------------------+
| Read Cafe au Lait for Java News: http://www.cafeaulait.org/ |
| Read Cafe con Leche for XML News: http://www.ibiblio.org/xml/ |
+----------------------------------+---------------------------------+
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: WhlslServlet.java
Type: application/octet-stream
Size: 4160 bytes
Desc: not available
Url : http://jdom.org/pipermail/jdom-interest/attachments/20010718/440d1897/WhlslServlet.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: WhlslPostTest.java
Type: application/octet-stream
Size: 2782 bytes
Desc: not available
Url : http://jdom.org/pipermail/jdom-interest/attachments/20010718/440d1897/WhlslPostTest.obj
More information about the jdom-interest
mailing list