tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "HEBBRON,TOM (HP-UnitedKingdom,ex2)" <tom_hebb...@hp.com>
Subject RE: Strange bug - XSLT filter on Tomcat 4.0 b6
Date Wed, 01 Aug 2001 11:02:56 GMT
Also, to follow up - there is another filter, this time from IBM devworks -
could someone please try this and tell me I'm not going mad - there is a bug
here?

Code from http://www-106.ibm.com/developerworks/library/j-tomcat/index.html

Ok - so set up the filter (DO NOT USE THE IE FILTER - this will bias your
experiment)
in web.xml change the settings to have a very much larger replace string
than the search string - eg:
  
  <filter>
        <filter-name>Replace Text Filter</filter-name>
 
<filter-class>com.ibm.devworks.filters.ReplaceTextFilter</filter-class>
         <init-param>
	    <param-name>search</param-name>
	    <param-value>cannot</param-value>
	  </init-param>
        <init-param>
	    <param-name>replace</param-name>
	    <param-value>must not - ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever EVER</param-value>
	  </init-param>
    </filter>

so we are replacing a 6byte text string with a 2865byte text string. 

Run the filter - hopefully you will see some strange results as I have:


here is the correct 3052byte output string
****************************************************************************
*******************************************
<html>
<head>
</head>
<body>
<h1>A Sample Index File</h1>
This is a sample index file. Please note that
most pages on this site must not - ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever
ever EVER be accessed
through the Internet.
</body>
</html>
****************************************************************************
*******************************************

and here is what we recieve in IE 5.5 (193 bytes exactly)

****************************************************************************
*******************************************
<html>
<head>
</head>
<body>
<h1>A Sample Index File</h1>
This is a sample index file. Please note that
most pages on this site must not - ever ever ever ever ever ever ever ever
ever eve
****************************************************************************
*******************************************

and now, strangest of all (why do different browsers get different data from
same filter - wierd indeed) the netscape 4.75 response (1460bytes)
****************************************************************************
*******************************************
<html>
<head>
</head>
<body>
<h1>A Sample Index File</h1>
This is a sample index file. Please note that
most pages on this site must not - ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever
ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever 
****************************************************************************
*******************************************

So there you have it - I hope these findings are repeatable - and someone
can explain why this happens - for now, I'm puzzled.

Cheers,

Tom



-----Original Message-----
From: HEBBRON,TOM (HP-UnitedKingdom,ex2) [mailto:tom_hebbron@hp.com]
Sent: 01 August 2001 10:56
To: 'tomcat-user@jakarta.apache.org'
Subject: Strange bug - XSLT filter on Tomcat 4.0 b6



Hi - I've been writing an XSLT filter using the servlet 2.3 filter
mechanism, and have come across this bug several times, including in the
example xslt filter at suns JDC
(http://developer.java.sun.com/developer/JDCTechTips/2001/tt0626.html#tip2)

Basically, if the size of the transformation result is greater than the
source xml file size, the output will be truncated.
So, if I serve index.xml (599bytes) using the filter, and an xsl file which
adds quite a lot of fancy html around the data from index.xml, I wil only
get the first 599bytes of the output - although printing this output to
System.out just after calling transformer.transform will yield the complete
result stream.

The code I am using is published at the above URL.

I have also tried a couple of other example XSLT filters, and all of them
have either come up with this error, or failed to work completely.

Is this a problem with adding to the size of the servlet response - is it a
fixed size?

Thanks for any help/suggestions - I felt sure that someone else must have
discovered this as well, but couldn't see anything on the web or mail
archives.


-- 
Tom Hebbron                             Tel: + 44 (0) 11731 29300 
hp BCO e-business                       Fax: + 44 (0) 11731 29923 
tom_hebbron@hp.com       

  

Mime
View raw message