diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2008-09-17 05:42:34 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2008-09-17 05:42:34 +0000 |
commit | e88e2112b229af176ea2e98f5f5f8dd7b863fd4f (patch) | |
tree | 9f27c9300c339507d5826644fe730efa0d54763d /branches/sca-equinox/modules/binding-http-runtime/src/main/java/org | |
parent | 19e2a4048613e0c5bc00ba7d67ebf14cf0baa291 (diff) |
TUSCANY-2601 HTTP binding ETag and LastModified test cases
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@696157 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r-- | branches/sca-equinox/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPBindingListenerServlet.java | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/branches/sca-equinox/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPBindingListenerServlet.java b/branches/sca-equinox/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPBindingListenerServlet.java index 582742bd3f..e969749358 100644 --- a/branches/sca-equinox/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPBindingListenerServlet.java +++ b/branches/sca-equinox/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPBindingListenerServlet.java @@ -311,10 +311,21 @@ public class HTTPBindingListenerServlet extends HttpServlet { throw new ServletException((Throwable)responseMessage.getBody());
}
- // Put ETag and LastModified in response.
- CacheContext cc = (CacheContext)responseMessage.getBody();
- response.setHeader( "ETag", cc.getETag() );
- response.setHeader( "LastModified", cc.getLastModified() );
+
+ // Test if the ETag and LastModified are returned as a cache context.
+ Object body = responseMessage.getBody();
+ if ( body.getClass() == CacheContext.class ) {
+ // Transfer to header if so.
+ CacheContext cc = (CacheContext)responseMessage.getBody();
+ if (( cc != null ) && ( cc.isEnabled() )) {
+ String eTag = cc.getETag();
+ if ( eTag != null )
+ response.setHeader( "ETag", cc.getETag() );
+ String lastModified = cc.getLastModified();
+ if ( lastModified != null)
+ response.setHeader( "LastModified", cc.getLastModified() );
+ }
+ }
}
/**
|