Mantis - Resin
Viewing Issue Advanced Details
279 minor always 06-20-05 00:00 01-26-06 15:23
user241  
ferg  
normal  
closed  
3.0.13 fixed  
none    
none 3.0.18  
0000279: proxy caching for included jsp's doesn't always work
RSN-314
i am not sure how provide evidence of this problem other than giving you are entire web application. essentially, for some reason, certain jsps do not get cached by resin. these files are being generated called as includes, eg:

request.getRequestDispatcher(includeURI).include(request, response);

the pattern is hard to nail down, except that:
1. generally, small jsps always get cached. the same file/jsp that has a larger size (eg. more records on the screen) will not get cached, but there is no fixed size where things stop getting cached - it seems to be dependent upon the particular jsp.
2. the complexity of the page seems to make a difference - a very large page that is just a dump of html will get cached (into the megabytes), whereas a smaller page (say 15k) that has lots of java scriplets, etc in it won't get cached.

i have tried the cache max-entry-size parameter to no avail. (what is it's default anyways??).
it seems like something in the processing of a jsp is causing the page to marked as 'dirty' or non-cacheable or something.

in resin 2.x, all of my included jsp's get cached as expected and behave correctly.

christian
3.x pro.

Notes
(0000314)
user241   
06-20-05 00:00   
i should have listed this bug as a high priority. it's a show stopper for migrating to resin 3.
(0000315)
user241   
06-20-05 00:00   
after further testing, i have discovered that of those pages that are sensitive to a size, the cutoff point is 16384 exactly i.e. 16k. anything larger than this size will not get cached by resin.
(0000316)
nquery   
06-20-05 00:00   
i have whittled this issue down to the following:

if more than 16k (16384 bytes exactly) of data is written out to bodyContent.getEnclosingWriter() from within the doAfterBody method of a tag then the page won't cache. eg.

    public int doAfterBody() throws JspException {

          BodyContent bc = getBodyContent();
          bc.getEnclosingWriter().print(something bigger than 16k);
        }

if instead i store the contents to a instance variable and then write the contents out from doEndTag then it works!!

    public int doEndTag() throws JspException {

        try {
            pageContext.getOut().print(somethinglargerthan16k);
        } catch (IOException e) {
            e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
        }

        return EVAL_PAGE;
    }

I have coded a work around as seen in the attached file, but it looks like there is definitely a bug in the enclosing writer's when handling tag bodies.
(0000791)
ferg   
01-26-06 15:23   
jsp/17ah