7 Replies Latest reply on Nov 18, 2009 3:01 AM by Bertrand Gillis

    JBoss AS 5.1.0 & JBoss Web 2.1.3, JSP truncated ?!?!?

    Bertrand Gillis Newbie

      Hi guys and Jboss experts,

      As suggested, I'm asking some help and advices about a weird issue when deploying a webapp to JBoss AS 5.1.0. You will find all the details about this issue on Jboss AS Users Forum.

      Thanks in advance for your assistance.

        • 1. Re: JBoss AS 5.1.0 & JBoss Web 2.1.3, JSP truncated ?!?!?
          Bertrand Gillis Newbie

          I've built a new webapp that can be used to replay this issue easily.

          A Jsp is called when the welcome page is accessed. This Jsp contains a Jsp tag that writes Html with or without the error depending on a tag property ("error" attribute):

          - When the error flag is false, a simple text is written (x) times. The number of iterations is managed through a tag property ("iteration" attribute).

          - When the error flag is true, a 3 bytes encoded character (unicode reference: U+2019, Right Single Quotation Mark) is written through the JspWriter.

          In this webapp, the expected result is to write 1000 times the simple text, than the special character and at least, 1000 times the simple text again. As you will see, the response output stream is unfortunately flushed and closed before the all Jsp output text is processed.

          In order to solve this issue, you can had the following snippet to the Jsp source:

          <%@ page contentType="text/html; charset=UTF-8" %>


          But I still don't understand why this issue happens only in the lastest versions of JBoss AS (5.0.x and 5.1.x)... and not in Tomcat nor in JBoss Web nor in previous versions of Jboss AS.

          • 2. Re: JBoss AS 5.1.0 & JBoss Web 2.1.3, JSP truncated ?!?!?
            Teijo Aulin Newbie

            I've a similar issue, copy-pasting from my earlier post:

            ---
            I've a JSP that I use to print out contents of txt files. I ran into trouble with some files which when opened cause JBoss to truncate the output of the JSP page, even though the page is executed to the end. I debugged this and found the following.

            The files are saved as UTF8, and contain the "em dash" character, U+2014 (8212) unicode, or & mdash; in html (without the space, it seems these forums can't handle the character either). The UTF8 byte sequence is "E2 80 94".

            Now, when I read the file contents with BufferedReader (InputStreamReader opened with UTF8), line by line, and print the lines out, the output is truncated to the first line containing the character, and nothing after that is printed.

            Is this a bug or a 'feature' ? Seems very strange behavior.
            ---

            Just now I noticed, this is also happening with the "Right single quotation mark".

            • 3. Re: JBoss AS 5.1.0 & JBoss Web 2.1.3, JSP truncated ?!?!?
              Teijo Aulin Newbie

              Nevermind my post, setting the page attribute fixed this.

              • 4. Re: JBoss AS 5.1.0 & JBoss Web 2.1.3, JSP truncated ?!?!?
                jaikiran pai Master

                 

                "bgillis" wrote:

                But I still don't understand why this issue happens only in the lastest versions of JBoss AS (5.0.x and 5.1.x)... and not in Tomcat nor in JBoss Web nor in previous versions of Jboss AS.


                I don't know the answer to why it works on other versions and neither am i an expert on this, but i guess instead of adding the character encoding to each JSP, you could probably set the URIEncoding at the connector level in JBOSS_HOME/server/< servername>/deploy/jbossweb.sar/server.xml:

                <Connector protocol="HTTP/1.1" port="8080" address="${jboss.bind.address}"
                 connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8"/>


                As per the tomcat connector doc http://tomcat.apache.org/tomcat-5.5-doc/config/ajp.html, if this attribute is not set, then the default is ISO-8859-1.

                • 5. Re: JBoss AS 5.1.0 & JBoss Web 2.1.3, JSP truncated ?!?!?
                  Bertrand Gillis Newbie

                  I'm aware of the ajp connector attributes in particular, URIEncoding. But as far as I know, this attribute is used for the request URI only and not the request or response bodies.

                  One more thing... I don't understand neither why I don't see any exception when this issue happens. Is it normal that the response stream is flushed and closed abnormally without throwing any exception ?

                  • 6. Re: JBoss AS 5.1.0 & JBoss Web 2.1.3, JSP truncated ?!?!?
                    Bertrand Gillis Newbie

                    To fix this issue temporarily, you can also use a servlet filter from Spring Framework to apply a character encoding if it is not already set.

                    But as I've just said... it is just a temporary fix. It doesn't explain the cause of the issue occuring in JBoss AS 5.0.x/5.1.x only.

                    • 7. Re: JBoss AS 5.1.0 & JBoss Web 2.1.3, JSP truncated ?!?!?
                      Bertrand Gillis Newbie

                      This bug seems to be resolved partially since JBoss Web 2.1.4. Unfortunately, this version of JBoss Web is not available in any current version of JBoss AS. You can find the full details on Jira JBAS-6442.