Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004990 [Resin] minor always 03-15-12 16:23 05-22-12 16:14
Reporter rickHigh View Status public  
Assigned To ferg
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 4.0.28 Product Version
  Product Build
Summary 0004990: ProxyCacheFilterChain calls getHeader but wrapped HttpServletResponse missing getHeader method
Description ProxyCacheFilterChain calls getHeader but wrapped HttpServletResponse missing getHeader method.


CauchoResponseWrapper.getHeader is called by ProxyCacheFilterChain.



Here is the code.

CauchoResponseWrapper

  public String getHeader(String name)

  {

    return _response.getHeader(name);

  }


In Resin 3, it checked its own internal getHeader because the Servlet specification did not have a getHeader.
Without the cache control headers, the ProxyCache will not cache the results.

To make this backwards compatible with Resin 3, the proposed changes are as follows:




  public String getHeader(String name)

  {

    return _response.getHeader(name);

  }

In a way, the problem is in their code because they were suppose to subclass javax..HttpServletResponseWrapper not implement javax..HttpServletResponse. HttpServletResponseWrapper was created to avoid this type of problem. But if their code predates Servlet specification 2.3, then it is certainly not their problem. Going to make a note to make sure we do the same type of support for all new methods in our wrapper class.

  public String getHeader(String name)

  {

      try {

          return _response.getHeader(name);

      } catch (AbstractMethodError ame) {

          return null;

      }

  }

The above should do the trick, and make Resin 4 backwards compatible with Resin 3 wrt to ProxyCache.

  public String getHeader(String name) {
      try {
          return _response.getHeader(name);
      } catch (AbstractMethodError ame) {
          return null;
      }
  }


Stack trace...



[12-03-14 11:39:59.208] {http://*:8080-2} [^] java.lang.AbstractMethodError
                        at com.caucho.server.http.CauchoResponseWrapper.getHeader(CauchoResponseWrapper.java:314)
                        at com.caucho.server.httpcache.ProxyCacheFilterChain.fillEntry(ProxyCacheFilterChain.java:1018)
                        at com.caucho.server.httpcache.ProxyCacheFilterChain.startCaching(ProxyCacheFilterChain.java:859)
                        at com.caucho.server.webapp.IncludeResponseStream2.startCaching(IncludeResponseStream2.java:336)
                        at com.caucho.server.webapp.IncludeResponseStream2.flushCharBuffer(IncludeResponseStream2.java:184)
                        at com.caucho.server.http.ToByteResponseStream.flushBuffer(ToByteResponseStream.java:608)
                        at com.caucho.jsp.JspWriterAdapter.close(JspWriterAdapter.java:297)
                        at com.caucho.jsp.JspWriterAdapter.popWriter(JspWriterAdapter.java:280)
                        at com.caucho.jsp.PageContextImpl.release(PageContextImpl.java:1412)
                        at com.caucho.jsp.PageManager.freePageContext(PageManager.java:215)
Steps To Reproduce
Additional Information
Attached Files

- Relationships

- Notes
(0005712)
rickHigh
03-15-12 16:30

Fixed in 4.0.27

http://bugs.caucho.com/view.php?id=4990 [^]

CauchoResponseWrapper.getHeader is called by ProxyCacheFilterChain.



Here is the code.

CauchoResponseWrapper

  public String getHeader(String name)

  {

    return _response.getHeader(name);

  }


In Resin 3, it checked its own internal getHeader because the Servlet specification did not have a getHeader.
Without the cache control headers, the ProxyCache will not cache the results.

To make this backwards compatible with Resin 3, the proposed changes are as follows:




  public String getHeader(String name)

  {

    return _response.getHeader(name);

  }

In a way, the problem is in their code becaue they were suppose to subclass javax..HttpServletResponseWrapper not implement javax..HttpServletResponse. HttpServletResponseWrapper was created to avoid this type of problem. But if their code predates Servlet specification 2.3, then it is certainly not their problem. I am going to make a note to make sure we do the same type of support for all new methods in our wrapper class.

  public String getHeader(String name)

  {

      try {

          return _response.getHeader(name);

      } catch (AbstractMethodError ame) {

          return null;

      }

  }

The above should do the trick, and make Resin 4 backwards compatible with Resin 3 wrt to ProxyCache.
 

- Issue History
Date Modified Username Field Change
03-15-12 16:23 rickHigh New Issue
03-15-12 16:30 rickHigh Note Added: 0005712
03-15-12 16:32 rickHigh Description Updated
05-22-12 16:14 ferg Assigned To  => ferg
05-22-12 16:14 ferg Status new => closed
05-22-12 16:14 ferg Resolution open => fixed
05-22-12 16:14 ferg Fixed in Version  => 4.0.28


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
30 total queries executed.
26 unique queries executed.
Powered by Mantis Bugtracker