Hi Matt

Sorry for a delay.


On Fri, Mar 18, 2011 at 10:15 AM, Matthew Glubb <[email protected]> wrote:

> Hi All,
>
> I'm trying to use ehcache-web 2.0.3 with apache-cxf 2.3.3 and Tomcat 6.
> There doesn't seem to be much in the way of information online about it and
> I wondered if anyone else had tried it. I have an issue where for the first,
> uncached request I get the following error:
>
> net.sf.ehcache.constructs.web.AlreadyCommittedException: Response already
> committed after doing buildPagebut before writing response from PageInfo.
>
> Subsequent requests are returned correctly by the cache until the cache
> content goes stale and then we get the same error above.
>
> Googling turns up similar issues that seem to have subsequently been fixed
> for WebLogic but no issues have been reported for Tomcat.
>
> I'm not massively knowledgeable about the internals of Tomcat's
> request/response pipeline but it seems to me that when ehcache records a
> cache miss, it passes the request down the line to the CXF servlet but CXF
> commits the response before ehcache has a chance to modify the response
> headers.
>
>
Do you know if ehcache filters are wrapping the servlet response stream ?
May be in some specific case the flush() is called on the output stream in
one of the CXF providers which may be the cause of this exception ?


> I've got a pretty simple web.xml at the moment (see it at the end of this
> email). Can anyone cast any light on this? How can I ensure that CXF doesn't
> commit the response before the end of the filter chain?
>
> I've already tried adding:
>
> <dispatcher>REQUEST</dispatcher>
> <dispatcher>INCLUDE</dispatcher>
> <dispatcher>FORWARD</dispatcher>
>
> to my filter mapping but it didn't appear to make any difference.
>
> Thanks very much,
>
>
If you could open a JIRA and provide a simple maven project for us to
test/debug then it can help...

thanks, Sergey


>
> Matt
>
>
> Matthew Glubb
> Technical Partner
>
> email: [email protected]
> phone: 44 (0) 7715 754017
> skype: mglubb
>
> Kite
> http://madebykite.com
>
> --
> GPG: 96FF DE0E 0B7B 37F0 7F8D C54C E285 3D8F 5625 9244
>
> <context-param>
>    <param-name>contextConfigLocation</param-name>
>    <param-value>classpath*:webappContext.xml
> /WEB-INF/rio-servlet.xml</param-value>
> </context-param>
>
> <listener>
>
>  
> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> </listener>
>
> <filter>
>    <filter-name>SimplePageCachingFilter</filter-name>
>
>  
> <filter-class>net.sf.ehcache.constructs.web.filter.SimplePageCachingFilter</filter-class>
>    <init-param>
>        <param-name>varyHeader</param-name>
>        <param-value>true</param-value>
>    </init-param>
> </filter>
>
> <filter-mapping>
>    <filter-name>SimplePageCachingFilter</filter-name>
>    <url-pattern>/objects/*</url-pattern>
> </filter-mapping>
>
> <servlet>
>    <servlet-name>rio</servlet-name>
>
>  <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
>    <load-on-startup>1</load-on-startup>
> </servlet>
>
> <servlet-mapping>
>    <servlet-name>rio</servlet-name>
>    <url-pattern>/*</url-pattern>
> </servlet-mapping>

Reply via email to