tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeffrey Winter" <jeffreywin...@attbi.com>
Subject [Fatal Error] :-1:-1: Premature end of file.
Date Sat, 11 Jan 2003 01:15:12 GMT
I am getting a Fatal Error when POSTing, but not PUTing,
some XML data to my servlet.

In the Command Window the following is shown:

   "[Fatal Error] :-1:-1: Premature end of file."

I also print out the Exception that I caught:

   Error: org.xml.sax.SAXParseException: Premature end of file.

This occurs when attempting to parse some XML
data that I have POSTed to the servlet in its doPost() method.  
The relavent code is here:

   // stream of posted entity
   InputStream istream = req.getInputStream();

   // parse the supplied document
   DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
   DocumentBuilder builder = factory.newDocumentBuilder();   
   // Exception thrown during this call
   Document inputDocument = builder.parse(istream);  


If I instead PUT the same data to the doPut() method, which
does nothing but call doPost(), the method works without a 
problem.


Here are the headers and the test XML entity that are sent with the 
XML document for the POST and the PUT.  You can see that they are 
the exact same except for the method.

   POST /myservlet?name=xxx HTTP/1.1
   Authorization: Basic d2ludGVyOndpbnRlcg==
   User-Agent: curl/7.9.5 (win32) libcurl 7.9.5
   Host: localhost:8080
   Pragma: no-cache
   Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
   Content-Length: 235
   Content-Type: application/x-www-form-urlencoded

   <test/>



   PUT /bookmarks/rest/?user=winter HTTP/1.1
   Authorization: Basic d2ludGVyOndpbnRlcg==
   User-Agent: curl/7.9.5 (win32) libcurl 7.9.5
   Host: localhost:8080
   Pragma: no-cache
   Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
   Content-Length: 235
   Content-Type: application/x-www-form-urlencoded

   <test/>

--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message