You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by "Tamil Ramasamy (JIRA)" <ji...@apache.org> on 2009/02/26 21:05:01 UTC

[jira] Created: (SHINDIG-954) Shindig does not recognize Response Headers for Cache TTL

Shindig does not recognize Response Headers for Cache TTL
---------------------------------------------------------

                 Key: SHINDIG-954
                 URL: https://issues.apache.org/jira/browse/SHINDIG-954
             Project: Shindig
          Issue Type: Bug
          Components: Java
    Affects Versions: trunk
         Environment: OS: Windows XP / Solaris
Server: Weblogic

            Reporter: Tamil Ramasamy


It looks like the cache headers of HTTP requests are not considered for EHCache Cache TTL. However, it is being captured in org.apache.shindig.gadgets.http.HttpResponse, using method getCacheTtl() and getCacheExpiration();

Please fix it for better usage of Ehcache. Thanks!

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SHINDIG-954) Shindig does not recognize Response Headers for Cache TTL

Posted by "Vincent Siveton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-954?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12678955#action_12678955 ] 

Vincent Siveton commented on SHINDIG-954:
-----------------------------------------

I confirm test errors, but the logic sounds good to me. Waiting for your test patch :)

> Shindig does not recognize Response Headers for Cache TTL
> ---------------------------------------------------------
>
>                 Key: SHINDIG-954
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-954
>             Project: Shindig
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: trunk
>         Environment: OS: Windows XP / Solaris
> Server: Weblogic
>            Reporter: Tamil Ramasamy
>         Attachments: java.zip
>
>
> It looks like the cache headers of HTTP requests are not considered for EHCache Cache TTL. However, it is being captured in org.apache.shindig.gadgets.http.HttpResponse, using method getCacheTtl() and getCacheExpiration();
> Please fix it for better usage of Ehcache. Thanks!

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SHINDIG-954) Shindig does not recognize Response Headers for Cache TTL

Posted by "Tamil Ramasamy (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SHINDIG-954?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tamil Ramasamy updated SHINDIG-954:
-----------------------------------

    Attachment:     (was: java.zip)

> Shindig does not recognize Response Headers for Cache TTL
> ---------------------------------------------------------
>
>                 Key: SHINDIG-954
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-954
>             Project: Shindig
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: trunk
>         Environment: OS: Windows XP / Solaris
> Server: Weblogic
>            Reporter: Tamil Ramasamy
>
> It looks like the cache headers of HTTP requests are not considered for EHCache Cache TTL. However, it is being captured in org.apache.shindig.gadgets.http.HttpResponse, using method getCacheTtl() and getCacheExpiration();
> Please fix it for better usage of Ehcache. Thanks!

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SHINDIG-954) Shindig does not recognize Response Headers for Cache TTL

Posted by "Kevin Brown (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-954?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12682855#action_12682855 ] 

Kevin Brown commented on SHINDIG-954:
-------------------------------------

DefaultGadgetSpecFactory intentionally ignores HTTP response headers in all cases, because there is no standard way to override them. This change would cause most gadgets to be re-fetched far more frequently than is appropriate, to the detriment of both the end user and the gadget developer.

There is no difference between "cache time" and "forced cache time" in the HttpRequest object, so the change here is essentially a no op. We generally do not honor HTTP request headers, because an HttpRequest object does not represent a request from an end user.

Lastly, this patch doesn't actually do what the description claims it does. EhCache will still use the TTL that is configured in the cache.conf file after you apply it, because the EhCache wrapper only stores String -> Object mappings, and is not aware of any per-object type differences.

> Shindig does not recognize Response Headers for Cache TTL
> ---------------------------------------------------------
>
>                 Key: SHINDIG-954
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-954
>             Project: Shindig
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: trunk
>         Environment: OS: Windows XP / Solaris
> Server: Weblogic
>            Reporter: Tamil Ramasamy
>         Attachments: patch_SHINDIG-954.zip
>
>
> It looks like the cache headers of HTTP requests are not considered for EHCache Cache TTL. However, it is being captured in org.apache.shindig.gadgets.http.HttpResponse, using method getCacheTtl() and getCacheExpiration();
> Please fix it for better usage of Ehcache. Thanks!

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SHINDIG-954) Shindig does not recognize Response Headers for Cache TTL

Posted by "Tamil Ramasamy (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SHINDIG-954?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tamil Ramasamy updated SHINDIG-954:
-----------------------------------

    Attachment: java.zip

So, I have updated the code to use them when adding responses to Cache. Please find the attached diff files for the same against revision 747407. 

Could someone please review the changes and commit it to repo? Thanks!

/shindig-apache/java/gadgets/src/main/java

./org/apache/shindig/gadgets/DefaultGadgetSpecFactory.java
./org/apache/shindig/gadgets/http/AbstractHttpCache.java
./org/apache/shindig/gadgets/http/HttpRequest.java
./org/apache/shindig/gadgets/servlet/ProxyHandler.java

There could be few junit test failures. I will provide updated test cases whenever i find time.

> Shindig does not recognize Response Headers for Cache TTL
> ---------------------------------------------------------
>
>                 Key: SHINDIG-954
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-954
>             Project: Shindig
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: trunk
>         Environment: OS: Windows XP / Solaris
> Server: Weblogic
>            Reporter: Tamil Ramasamy
>         Attachments: java.zip
>
>
> It looks like the cache headers of HTTP requests are not considered for EHCache Cache TTL. However, it is being captured in org.apache.shindig.gadgets.http.HttpResponse, using method getCacheTtl() and getCacheExpiration();
> Please fix it for better usage of Ehcache. Thanks!

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SHINDIG-954) Shindig does not recognize Response Headers for Cache TTL

Posted by "Tamil Ramasamy (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SHINDIG-954?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tamil Ramasamy updated SHINDIG-954:
-----------------------------------

    Attachment: patch_SHINDIG-954.zip

I have updated the code to use Response Cache Headers when adding responses to Cache. Please find the attached diff files for the same against revision 754898. 

Could someone please review the changes and commit it to repo? Thanks!

/shindig-apache/java/gadgets/src/main/java

./org/apache/shindig/gadgets/DefaultGadgetSpecFactory.java
./org/apache/shindig/gadgets/http/AbstractHttpCache.java
./org/apache/shindig/gadgets/http/HttpRequest.java
./org/apache/shindig/gadgets/servlet/ProxyHandler.java

Junit test cases Fixed for above changes, 

/shindig-apache/java/gadgets/src/test/java

./org/apache/shindiggadgets/http/AbstractHttpCacheTest.java
./org/apache/shindiggadgets/http/DefaultHttpCacheTest.java
./org/apache/shindiggadgets/http/DefaultInvalidationServiceTest.java
./org/apache/shindiggadgets/render/HtmlRendererTest.java


As you can see in test cases, I had to add 'ETag' in response header to identify integrity of HttpResponse from cache. It was previously done by simple response string comparison ( including HTTP header + actual content ).

Since AbstractHttpCache.java rewrites response header for cache using HttpResponse.getCacheTtl() method and this creates few milliseconds difference between the object that was passed and object which is added to cache. Hope this explains everything. 

Thanks!

PS: I removed previously attached diff files to avoid confusion.   

> Shindig does not recognize Response Headers for Cache TTL
> ---------------------------------------------------------
>
>                 Key: SHINDIG-954
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-954
>             Project: Shindig
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: trunk
>         Environment: OS: Windows XP / Solaris
> Server: Weblogic
>            Reporter: Tamil Ramasamy
>         Attachments: patch_SHINDIG-954.zip
>
>
> It looks like the cache headers of HTTP requests are not considered for EHCache Cache TTL. However, it is being captured in org.apache.shindig.gadgets.http.HttpResponse, using method getCacheTtl() and getCacheExpiration();
> Please fix it for better usage of Ehcache. Thanks!

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.