commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Romain Manni-Bucau (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (JCS-140) JCacheFilter code logic error
Date Wed, 01 Apr 2015 17:01:53 GMT

    [ https://issues.apache.org/jira/browse/JCS-140?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14390980#comment-14390980
] 

Romain Manni-Bucau commented on JCS-140:
----------------------------------------

[~tv] sure

> JCacheFilter code logic error
> -----------------------------
>
>                 Key: JCS-140
>                 URL: https://issues.apache.org/jira/browse/JCS-140
>             Project: Commons JCS
>          Issue Type: Bug
>            Reporter: liangjiarui
>            Assignee: Romain Manni-Bucau
>             Fix For: jcs-2.0-beta-2
>
>
>          final PageKey key = new PageKey(key(servletRequest), gzip);
>         Page page = cache.get(key);
>         if (page == null)
>         {
>              ....
>         }
>         if (page.status == SC_OK) {
>             checkResponse(httpServletResponse);
> the last line always throw exception for the first time the specified url is requested,because
the response is commited  in the previous if.
> I think the logic of doFilter should be like this:
> String key=getKeyFromRequest();
> Page page=cache.get(key);
> if(page==null){
> chain.doFilter();
> cache.put(key,response);
> }else{
> response.write(cache);
> }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message