2 Replies Latest reply on Aug 28, 2004 12:15 PM by Pete

    POST request truncated in JBoss but not in WebLogic?

    Pete Newbie

      Hi all,

      I am encountering a POST request truncation issue on JBoss 3.2.3(and 3.2.5 for that matter with Tomcat 5, even with maxPostSize explicitly set to a big value).

      The server application I am writing mandates me to use specific MIME-types in Content-Type HTTP header, therefore I cannot use the usual file upload tricks like multi-part/form-data. for uploading big files. Instead the application spec I am adhering to forces me to BASE64-encode the files and encloses them within XML(don't ask me why, I just follow the spec) and post this XML data in the request body of a POST request. As you can guess, the POST request can get arbitrarily huge.

      I am using JBoss 3.2.3 and 3.2.5, and in both cases, I notice the POST request gets truncated. In 3.2.3 case(Tomcat 4), it gets truncated to around 50kbytes. In 3.2.5 case(Tomcat 5), it gets truncated to 4kbytes!! To test this, I just write a plain-vanilla servlet and in the doPost() method, I just count the bytes I actually read from HttpServletRequest. I try the same test on WebLogic 8.1 SP2, and it works fine(at the very least, for 500kbyte and 1Mbyte files).

      I am not too verbose in JBoss so I am sure there may be some magic config file/switch I can use to make it work. I really really appreciate any info you can share with me! Many thanks!

      Regards,
      Pete

        • 1. Re: POST request truncated in JBoss but not in WebLogic?
          raquel araujo Newbie

          Hello, I am having a similar problem and I am wondering if you found the answer to your problem.
          Thanks...

          • 2. Re: POST request truncated in JBoss but not in WebLogic?
            Pete Newbie

            Hi there,

            Yes, I figured it out. It turns out that you will need to read the ServletInputStream byte-by-byte, something like the following:


            InputStreamReader insr = new InputStreamReader(req.getInputStream());
            BufferedReader in = new BufferedReader(insr);
            // cntLen is the length indicated in HTTP header
            char[] cntBody = new char[cntLen];
            int read = 0, cntByte = 0;
            while((cntByte = in.read()) != -1) {
            cntBody[read] = (char)cntByte;
            read++;
            }
            String strResult = new String(cntBody);

            It solved my problem. Not elegant for sure, but I am glad I get no truncation issue anymore. Hope this helps!