tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Asok Chattopadhyay <da.a...@gmail.com>
Subject Re: Tomcat strips CRLFs from the generated page
Date Mon, 13 Jan 2014 15:36:50 GMT
I am attaching the Test servlet and the text file that contains the  page.
The Test servlet simply reads the file and sends out to the browser. When I
run this servlet, it strips all CRLFs from line 153 onward.

Thanks.


On Mon, Jan 13, 2014 at 9:57 PM, Asok Chattopadhyay <da.asok@gmail.com>wrote:

> No, I don't have any filter, except for a session counter listener. I am
> going to make a demo servlet and post it soon once I am back at home,
>
> Thanks Dan. I really appreciate your help,
>
> Sent from my iPhone
>
> On 13 Jan, 2014, at 9:36 PM, Daniel Mikusa <dmikusa@gopivotal.com> wrote:
>
> > On Jan 13, 2014, at 8:26 AM, Asok Chattopadhyay <da.asok@gmail.com>
> wrote:
> >
> >> I checked the string, say, s, just before and after writing it to the
> PrintWriter.
> >>
> >> PrintWriter out=response.getWriter();
> >> Print("before="+s);
> >> out.println(s);
> >> out.flush();
> >> out.close();
> >> Print("after="+s);
> >>
> >> where Print is a static method printing on the log file localhost...log
> >>
> >> And the log shows no change. Obviously it looks like whatever is
> happening is happening in out.println.
> >
> > No, not necessarily.  It is quite possible for a servlet Filter to
> modify what you're writing to the output stream.  Does your application
> have any filters in place?
> >
> > Also, can you provide a demo servlet that replicates this behavior?
> >
> > Thanks
> >
> > Dan
> >
> >>
> >>
> >>
> >> Sent from my iPhone
> >>
> >> On 13 Jan, 2014, at 8:48 PM, Daniel Mikusa <dmikusa@gopivotal.com>
> wrote:
> >>
> >>> On Jan 13, 2014, at 6:09 AM, Asok Chattopadhyay <da.asok@gmail.com>
> wrote:
> >>>
> >>>> Hi,
> >>>>
> >>>> My servlet generates a page containing embedded JavaScript and
> sometimes
> >>>> the page received in the browser comes with CRLFs stripped from the
> text,
> >>>> starting at some point in the text. This creates a big problem if the
> >>>> script contains CRLF as statement separator instead of semi-colon.
> It's
> >>>> strange that not the entire text is stripped. Say, the first 150 lines
> >>>> comes as it is, whereas starting from line 151, all the CRLFs are
> stripped.
> >>>> It is fairly consistent for the same page.
> >>>
> >>> Sounds like an application / servlet error.  Have you tried hooking up
> a debugger and stepping through your code?
> >>>
> >>> Also, do you see this consistently across all servlets in your app or
> just one?
> >>>
> >>>>
> >>>> I am using Tomcat 6.0.37.
> >>>>
> >>>> Why does it happen? Is anything in the text triggers this? Is there
a
> way
> >>>> to overcome this problem, as I don't have control over the actual
> content?
> >>>
> >>> Seems unlikely that Tomcat would be doing this.  Check your servlet
> code.  Check if you have any filters in your application, perhaps one is
> modifying the content.
> >>>
> >>> Dan
> >>>
> >>>>
> >>>>
> >>>> Thanks in advance.
> >>>>
> >>>> Here is the example.
> >>>>
> >>>>
> >>>> LINE 148:    <script type="text/javascript"
> >>>> SRC="html/scripts/combotext.js"></script>
> >>>>
> >>>> LINE 149:    <script type="text/javascript"
> >>>> SRC="html/scripts/datepicker.js"></script>
> >>>>
> >>>> LINE 150:    <script type="text/javascript"
> >>>> SRC="html/scripts/combo.js"></script>
> >>>>
> >>>> LINE 151:    <script type="text/javascript"
> >>>> SRC="html/scripts/calc.js"></script>    <script type="text/javascript"
> >>>> SRC="html/scripts/dream.js"></script><script language="javascript"
> >>>> type="text/javascript">var buttonfunction
> >>>> clicked(b){button=b.value}function submitit(form){if
> >>>> (button=="Details"){form.page.value = "opcdt"form.searchbutton.value
=
> >>>> "Top"}}function pickProduct(link, cus){if
> >>>> (navigator.appName.indexOf("Netscape") >=
> >>>>
> 0){document.one.xinvnum.value=link.textdocument.one.xcus.value=cus.text}else{document.one.xinvnum.value=link.innerTextdocument.one.xcus.value=cus.innerText}return
> >>>> false}</script></head><body
> >>>> onload="topBottom();move_caret('one','xcrnnum');"
> >>>> style="margin:0;padding:0;"><!--<div id="darkBackgroundLayer"
> >>>> class="darkenBackground"> ...
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >>> For additional commands, e-mail: users-help@tomcat.apache.org
> >>>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
>

Mime
View raw message