1 Reply Latest reply on May 1, 2008 2:35 AM by shane.bryzak

    Http POST input is unparseable

    clarkester

      Hi,


      I am trying to use Seam in a non-JSF Web Application with version 2.0.0.GA.


      I have a servlet in the app which receives XML messages and processes them.


      My components.xml has


      <web:context-filter url-pattern="/m/*" />



      and I can see the Seam components being instantiated and invoked OK.


      However, I get the following message in my logs


      2008-04-30 10:59:33,086 DEBUG http-127.0.0.1-8080-1 [AbstractMessagingServlet] Extracting XML Document from HTTP Servlet Request...
      2008-04-30 10:59:33,101 ERROR http-127.0.0.1-8080-1 [LoggerStream] [Fatal Error] :-1:-1: Premature end of file.
      2008-04-30 10:59:33,101 DEBUG http-127.0.0.1-8080-1 [AbstractMessagingServlet] SAXException (Premature end of file.). Will try to dump raw request data...
      2008-04-30 10:59:33,101 DEBUG http-127.0.0.1-8080-1 [AbstractMessagingServlet] Content-type: application/x-www-form-urlencoded
      2008-04-30 10:59:33,101 DEBUG http-127.0.0.1-8080-1 [AbstractMessagingServlet] Content-Length: 575
      2008-04-30 10:59:33,101 DEBUG http-127.0.0.1-8080-1 [AbstractMessagingServlet] Error trying to dump raw request data (sorry)
      java.io.IOException: mark/reset not supported



      when I try and take the HttpServletRequest.getInputStream() and parse the contents into an XML Document using the following code:


       DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
              factory.setNamespaceAware(true);
              DocumentBuilder builder = factory.newDocumentBuilder();
      
              Document xmlDocument = builder.parse(request.getInputStream());
      
              if (LOG.isDebugEnabled()) {
                  LOG.debug("Dumping extracted XML Document...");
                  LOG.debug(DomHelper.toString(xmlDocument));
              }
              return xmlDocument;
              

            
      However, when I remove the Seam Filter from the XML message servlet


      <filter-mapping>
          <filter-name>Seam Filter</filter-name>
          <url-pattern>/dummy/*</url-pattern>
      </filter-mapping>         
      



      I can parse the message without any problems.


      Have you any idea why the stream is getting munged?


      Cheers


      Jon

        • 1. Re: Http POST input is unparseable
          shane.bryzak

          The only filter that should manipulate the request is MultipartFilter, and only if the request is a multipart request (i.e. a file upload).  If you could put together a reproducible test case and create a JIRA issue for it then I'd be happy to take a look.