[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xmlbeans-dev
Subject:    xmlobject stream closure upon parse affecting httpservletrequest application/xml
From:       Suire Rekv <suirerekv () yahoo ! com>
Date:       2009-05-30 18:54:10
Message-ID: 835638.97344.qm () web46112 ! mail ! sp1 ! yahoo ! com
[Download RAW message or body]

Hi,

When I use XmlObject.Factory.parse(InputStream is) to read the request object's \
InputStream for request type application/xml I sporadically get errors as attempting \
to read from a closed stream. This problem happens directly when I read it from a \
spring controller or via cxf.

To fix this I had to parse the inputstream to a string and then construct the \
xmlobject from the string. By default the cxf xmlbeans provider reads the stream \
directly and cannot be used as such.

To test this:

public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse \
response)  throws ServletException, IOException, Exception {
             XmlObject.Factor.parse(request.getInputStream());       
}

Try hitting the webpage multiple times and you will the exception.

Any suggestions?

Thanks,
Suire.



      


[Attachment #3 (text/html)]

<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: \
inherit;">Hi,<br><br>When I use XmlObject.Factory.parse(InputStream is) to read the \
request object's InputStream for request type application/xml I sporadically get \
errors as attempting to read from a closed stream. This problem happens directly when \
I read it from a spring controller or via cxf.<br><br>To fix this I had to parse the \
inputstream to a string and then construct the xmlobject from the string. By default \
the cxf xmlbeans provider reads the stream directly and cannot be used as \
such.<br><br>To test this:<br><br>public ModelAndView \
handleRequest(HttpServletRequest request, HttpServletResponse \
response)<br>&nbsp;&nbsp;&nbsp; throws ServletException, IOException, Exception \
{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; \
XmlObject.Factor.parse(request.getInputStream()); &nbsp; &nbsp;&nbsp;&nbsp; \
<br>}<br><br>Try hitting the webpage multiple times and you  will the \
exception.<br><br>Any suggestions?<br><br>Thanks,<br>Suire.<br></td></tr></table><br>

      



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic