You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Jean-Sebastien Delfino (JIRA)" <de...@tuscany.apache.org> on 2008/07/30 10:29:31 UTC

[jira] Created: (TUSCANY-2516) HTTP binding should support etag and if-modified headers

HTTP binding should support etag and if-modified headers
--------------------------------------------------------

                 Key: TUSCANY-2516
                 URL: https://issues.apache.org/jira/browse/TUSCANY-2516
             Project: Tuscany
          Issue Type: Wish
          Components: Java SCA Misc Binding Extensions
            Reporter: Jean-Sebastien Delfino
             Fix For: Java-SCA-Next


The HTTP binding currently does not support etag and if-modified headers for implementation-resource and implementation-widget components, preventing Web browsers to do any caching.

Supporting etag and if-modified should be easy for the above component implementation types, just a matter of calculating a checksum and use it as etag or checking the timestamp of the served file.

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


[jira] Commented: (TUSCANY-2516) HTTP binding should support etag and if-modified headers

Posted by "Dan Becker (JIRA)" <de...@tuscany.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-2516?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12619987#action_12619987 ] 

Dan Becker commented on TUSCANY-2516:
-------------------------------------

Note that TUSCANY-2477 implements this behavior for the Atom binding. Likely there will be shared ideas and implementation between these JIRAs.

> HTTP binding should support etag and if-modified headers
> --------------------------------------------------------
>
>                 Key: TUSCANY-2516
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2516
>             Project: Tuscany
>          Issue Type: Wish
>          Components: Java SCA Misc Binding Extensions
>            Reporter: Jean-Sebastien Delfino
>             Fix For: Java-SCA-Next
>
>
> The HTTP binding currently does not support etag and if-modified headers for implementation-resource and implementation-widget components, preventing Web browsers to do any caching.
> Supporting etag and if-modified should be easy for the above component implementation types, just a matter of calculating a checksum and use it as etag or checking the timestamp of the served file.

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


[jira] Commented: (TUSCANY-2516) HTTP binding should support etag and if-modified headers

Posted by "Dan Becker (JIRA)" <de...@tuscany.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-2516?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12624448#action_12624448 ] 

Dan Becker commented on TUSCANY-2516:
-------------------------------------

The Atom Binding ETags/LastModified caching provided in TUSCANY-2477 and demonstrated in TUSCANY-2537 takes advantage of the specific nature of the Abdera data model. In other words, Feeds and Entries, which both have unique IDs and updated fields,are used to provide the ETag and the LastModified field of the HTTP header. There is no need for a user to provide any implementation since the user already provides Feeds and Entries.

This JIRA is somewhat different. The HTTP binding can transport an arbitrary data type which may or may not have a unique ID or updated field. A good example of this is the existing TestGetImpl.java and TestServiceImpl.java in the Tuscany binding-http-runtime. These are implmentations that read and write strings to sockets directly. They implement no interface. The only business data is a raw String.

Because of the lack of a unique ID or update field or specific data type, I am considering pushing this provision responsibility to the service or API implementer. How to do this? There seem to be several ways, so let me state what I have considered to see if it is inline with the requester's expectations.

1) (My preferred design) One way to provide caching information (ETags/Lastmodified) is to annotate the business APIs that would use them. I envision a @HTTPRequestCache and @HTTPResponseCache annotation that mark methods that either provide or expect ETags and LastModified items in the header. The implementor would receive/provide a data object (perhaps CacheContext) in which to provide or read ETags/LastModified/predicates in the method. The implementator could generate these values from data base access, data values, or any other implementation. The HTTP binding can then inspect headers of these specially marked methods and take the normal caching actions as provided in the HTTP spec without ever invoking the implementation. This has the advantage of allowing complex business interfaces to only cache on a subset of actions (such as a Collection interface with CRUD methods to only cache on request methods).

2) Another design would be to require service implementors to implement a special Cacheable interface (similar to the Serializable interface). The HTTP binding would then use this  information to  read or provide ETags/LastModified in the headers. However, this would add caching overhead to all methods of a business interface.

Other ideas? Please let me know. I just wanted to propose the path that I am heading down in this very useful and far reaching feature.

> HTTP binding should support etag and if-modified headers
> --------------------------------------------------------
>
>                 Key: TUSCANY-2516
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2516
>             Project: Tuscany
>          Issue Type: Wish
>          Components: Java SCA Misc Binding Extensions
>            Reporter: Jean-Sebastien Delfino
>            Assignee: Dan Becker
>             Fix For: Java-SCA-Next
>
>
> The HTTP binding currently does not support etag and if-modified headers for implementation-resource and implementation-widget components, preventing Web browsers to do any caching.
> Supporting etag and if-modified should be easy for the above component implementation types, just a matter of calculating a checksum and use it as etag or checking the timestamp of the served file.

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


[jira] Assigned: (TUSCANY-2516) HTTP binding should support etag and if-modified headers

Posted by "ant elder (JIRA)" <de...@tuscany.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-2516?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

ant elder reassigned TUSCANY-2516:
----------------------------------

    Assignee: ant elder  (was: Dan Becker)

> HTTP binding should support etag and if-modified headers
> --------------------------------------------------------
>
>                 Key: TUSCANY-2516
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2516
>             Project: Tuscany
>          Issue Type: Wish
>          Components: Java SCA Misc Binding Extensions
>            Reporter: Jean-Sebastien Delfino
>            Assignee: ant elder
>             Fix For: Java-SCA-Next
>
>         Attachments: TUSCANY-2516.1.patch, TUSCANY-2516.patch
>
>
> The HTTP binding currently does not support etag and if-modified headers for implementation-resource and implementation-widget components, preventing Web browsers to do any caching.
> Supporting etag and if-modified should be easy for the above component implementation types, just a matter of calculating a checksum and use it as etag or checking the timestamp of the served file.

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


[jira] Updated: (TUSCANY-2516) HTTP binding should support etag and if-modified headers

Posted by "Dan Becker (JIRA)" <de...@tuscany.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-2516?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dan Becker updated TUSCANY-2516:
--------------------------------

    Attachment: TUSCANY-2516.1.patch

Thanks Ant. I did indeed forget to mark and include those two files (CacheContext and HttpBindingListenerServlet)  Please apply both patch files 2516 and 2516.1 to get complete fix.

> HTTP binding should support etag and if-modified headers
> --------------------------------------------------------
>
>                 Key: TUSCANY-2516
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2516
>             Project: Tuscany
>          Issue Type: Wish
>          Components: Java SCA Misc Binding Extensions
>            Reporter: Jean-Sebastien Delfino
>            Assignee: Dan Becker
>             Fix For: Java-SCA-Next
>
>         Attachments: TUSCANY-2516.1.patch, TUSCANY-2516.patch
>
>
> The HTTP binding currently does not support etag and if-modified headers for implementation-resource and implementation-widget components, preventing Web browsers to do any caching.
> Supporting etag and if-modified should be easy for the above component implementation types, just a matter of calculating a checksum and use it as etag or checking the timestamp of the served file.

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


[jira] Assigned: (TUSCANY-2516) HTTP binding should support etag and if-modified headers

Posted by "Dan Becker (JIRA)" <de...@tuscany.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-2516?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dan Becker reassigned TUSCANY-2516:
-----------------------------------

    Assignee: Dan Becker

> HTTP binding should support etag and if-modified headers
> --------------------------------------------------------
>
>                 Key: TUSCANY-2516
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2516
>             Project: Tuscany
>          Issue Type: Wish
>          Components: Java SCA Misc Binding Extensions
>            Reporter: Jean-Sebastien Delfino
>            Assignee: Dan Becker
>             Fix For: Java-SCA-Next
>
>
> The HTTP binding currently does not support etag and if-modified headers for implementation-resource and implementation-widget components, preventing Web browsers to do any caching.
> Supporting etag and if-modified should be easy for the above component implementation types, just a matter of calculating a checksum and use it as etag or checking the timestamp of the served file.

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


[jira] Commented: (TUSCANY-2516) HTTP binding should support etag and if-modified headers

Posted by "Dan Becker (JIRA)" <de...@tuscany.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-2516?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12624483#action_12624483 ] 

Dan Becker commented on TUSCANY-2516:
-------------------------------------

I just had a call from Sebastien who proposed several other alternatives in addition to discussing the ones above.

1) Sebastien proposed some simple requirements on the Tuscany user/implementer to provide APIs (such as conditionalGet, conditionalPut) that would contain ETag and LastModified as parameters. Introspection would move the ETag/LastModified between the HTTP header and the business API conditionalGet. This is somewhat similar to the current situation where the binding moves the item ID from the URI to the business API.

2) Another alternative would be a requirement on the Tuscany user/implementer to implement a Cacheable interface on the business data. This Cacheable interface would have getID/getETag and getUpdated/getLastModified methods on the business data. The attractive piece of this idea is that the existing code for binding-atom-abdera (which uses Feed and Entry to provide ID and Update elements) would be entirely similar to this new code.

In addition to the above idea, we discussed the drawbacks of implementing these features as a Java method annotation as proposed in the comments above (@HTTPRequestCache). Basically, an implementer would mark a method with this annotation, but they would have to call a conditionalGet method as in item 1 here. Two pieces of work instead of one.

We also discussed the idea of implementing a cache policy on the Java implementation. Again it appears that the Tuscany user in this case would be forced to add a policy notation, and then implement it. We viewed this as two pieces of work instead of one.

Other ideas are welcome. Personally, I am leaniing toward method 2 (Cacheable interface on business object) as the easiest and fewest requirements on the Tuscany user of caching. 

> HTTP binding should support etag and if-modified headers
> --------------------------------------------------------
>
>                 Key: TUSCANY-2516
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2516
>             Project: Tuscany
>          Issue Type: Wish
>          Components: Java SCA Misc Binding Extensions
>            Reporter: Jean-Sebastien Delfino
>            Assignee: Dan Becker
>             Fix For: Java-SCA-Next
>
>
> The HTTP binding currently does not support etag and if-modified headers for implementation-resource and implementation-widget components, preventing Web browsers to do any caching.
> Supporting etag and if-modified should be easy for the above component implementation types, just a matter of calculating a checksum and use it as etag or checking the timestamp of the served file.

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


[jira] Commented: (TUSCANY-2516) HTTP binding should support etag and if-modified headers

Posted by "Dan Becker (JIRA)" <de...@tuscany.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-2516?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12624462#action_12624462 ] 

Dan Becker commented on TUSCANY-2516:
-------------------------------------

Just reading up on the SCA policy framework (with which I am quite the beginner). It seems like the annotation to perform caching on the reply and caching on the request might best be fit into the SCA policy framework? The caching and ETag/LastModified support fot the http bindings seems similar to the authentication policies we provide for other bindings.

> HTTP binding should support etag and if-modified headers
> --------------------------------------------------------
>
>                 Key: TUSCANY-2516
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2516
>             Project: Tuscany
>          Issue Type: Wish
>          Components: Java SCA Misc Binding Extensions
>            Reporter: Jean-Sebastien Delfino
>            Assignee: Dan Becker
>             Fix For: Java-SCA-Next
>
>
> The HTTP binding currently does not support etag and if-modified headers for implementation-resource and implementation-widget components, preventing Web browsers to do any caching.
> Supporting etag and if-modified should be easy for the above component implementation types, just a matter of calculating a checksum and use it as etag or checking the timestamp of the served file.

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


[jira] Commented: (TUSCANY-2516) HTTP binding should support etag and if-modified headers

Posted by "ant elder (JIRA)" <de...@tuscany.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-2516?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12625652#action_12625652 ] 

ant elder commented on TUSCANY-2516:
------------------------------------

I'm having some trouble applying this patch, could some new files have been left out, 
org.apache.tuscany.sca.binding.http.CacheContext and HTTPBindingListenerServlet?


> HTTP binding should support etag and if-modified headers
> --------------------------------------------------------
>
>                 Key: TUSCANY-2516
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2516
>             Project: Tuscany
>          Issue Type: Wish
>          Components: Java SCA Misc Binding Extensions
>            Reporter: Jean-Sebastien Delfino
>            Assignee: Dan Becker
>             Fix For: Java-SCA-Next
>
>         Attachments: TUSCANY-2516.patch
>
>
> The HTTP binding currently does not support etag and if-modified headers for implementation-resource and implementation-widget components, preventing Web browsers to do any caching.
> Supporting etag and if-modified should be easy for the above component implementation types, just a matter of calculating a checksum and use it as etag or checking the timestamp of the served file.

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


[jira] Updated: (TUSCANY-2516) HTTP binding should support etag and if-modified headers

Posted by "Dan Becker (JIRA)" <de...@tuscany.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-2516?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dan Becker updated TUSCANY-2516:
--------------------------------

    Attachment: TUSCANY-2516.patch

Contains full implementation of HTTP binding cache support (ETags LastModified) on GET, PUT, POST, DELETE operations.

32 new unit tests have been added. Run with HttpBindingCacheTestCase JUnit test.

> HTTP binding should support etag and if-modified headers
> --------------------------------------------------------
>
>                 Key: TUSCANY-2516
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2516
>             Project: Tuscany
>          Issue Type: Wish
>          Components: Java SCA Misc Binding Extensions
>            Reporter: Jean-Sebastien Delfino
>            Assignee: Dan Becker
>             Fix For: Java-SCA-Next
>
>         Attachments: TUSCANY-2516.patch
>
>
> The HTTP binding currently does not support etag and if-modified headers for implementation-resource and implementation-widget components, preventing Web browsers to do any caching.
> Supporting etag and if-modified should be easy for the above component implementation types, just a matter of calculating a checksum and use it as etag or checking the timestamp of the served file.

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


[jira] Commented: (TUSCANY-2516) HTTP binding should support etag and if-modified headers

Posted by "Jean-Sebastien Delfino (JIRA)" <de...@tuscany.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-2516?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12624532#action_12624532 ] 

Jean-Sebastien Delfino commented on TUSCANY-2516:
-------------------------------------------------

Two more comments:

- option 2 still requires the conditionalGet(uri, ifNotMatchETag, ifModifiedSince) from option 1 since the business object does not flow into a get.

- option 1 would fix the current issue with the ATOM binding which doesn't flow the ifNotMatchETag, ifModifiedSince info to the get(uri) method.


> HTTP binding should support etag and if-modified headers
> --------------------------------------------------------
>
>                 Key: TUSCANY-2516
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2516
>             Project: Tuscany
>          Issue Type: Wish
>          Components: Java SCA Misc Binding Extensions
>            Reporter: Jean-Sebastien Delfino
>            Assignee: Dan Becker
>             Fix For: Java-SCA-Next
>
>
> The HTTP binding currently does not support etag and if-modified headers for implementation-resource and implementation-widget components, preventing Web browsers to do any caching.
> Supporting etag and if-modified should be easy for the above component implementation types, just a matter of calculating a checksum and use it as etag or checking the timestamp of the served file.

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


[jira] Closed: (TUSCANY-2516) HTTP binding should support etag and if-modified headers

Posted by "ant elder (JIRA)" <de...@tuscany.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-2516?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

ant elder closed TUSCANY-2516.
------------------------------

    Resolution: Fixed

Applied, thanks for the patch Dan

> HTTP binding should support etag and if-modified headers
> --------------------------------------------------------
>
>                 Key: TUSCANY-2516
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2516
>             Project: Tuscany
>          Issue Type: Wish
>          Components: Java SCA Misc Binding Extensions
>            Reporter: Jean-Sebastien Delfino
>            Assignee: ant elder
>             Fix For: Java-SCA-Next
>
>         Attachments: TUSCANY-2516.1.patch, TUSCANY-2516.patch
>
>
> The HTTP binding currently does not support etag and if-modified headers for implementation-resource and implementation-widget components, preventing Web browsers to do any caching.
> Supporting etag and if-modified should be easy for the above component implementation types, just a matter of calculating a checksum and use it as etag or checking the timestamp of the served file.

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


[jira] Updated: (TUSCANY-2516) HTTP binding should support etag and if-modified headers

Posted by "Dan Becker (JIRA)" <de...@tuscany.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-2516?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dan Becker updated TUSCANY-2516:
--------------------------------

    Patch Info: [Patch Available]

> HTTP binding should support etag and if-modified headers
> --------------------------------------------------------
>
>                 Key: TUSCANY-2516
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2516
>             Project: Tuscany
>          Issue Type: Wish
>          Components: Java SCA Misc Binding Extensions
>            Reporter: Jean-Sebastien Delfino
>            Assignee: Dan Becker
>             Fix For: Java-SCA-Next
>
>         Attachments: TUSCANY-2516.patch
>
>
> The HTTP binding currently does not support etag and if-modified headers for implementation-resource and implementation-widget components, preventing Web browsers to do any caching.
> Supporting etag and if-modified should be easy for the above component implementation types, just a matter of calculating a checksum and use it as etag or checking the timestamp of the served file.

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