Hello people,

We are using the repository-adapter for retrieving documents from the 
repository (e.g. running DASL's from within portal or just using the 
webdav-client).
Responses from the repository are cached, by WebdavServiceImpl, 
WebdavCacheHandler, CachingServiceImpl etc.

However, the cache does not discern positive responses (with HTTP code 2xx/3xx) 
from negative ones (4xx, 5xx).
I would like to add that to our environment.

As the above mentioned classes do not provide possibilities for injection of a 
class with does that, I had to create a subclass of CachingServiceImpl. (see 
attached 'NoErrorResponseCachingServiceImpl')
I'm not fond of this solution.

Would it be possible to either incorporate this behaviour in one of the hippo 
classes or to provide a possibility to inject such behaviour?
(see attached patches)

Thanks in advance.

Regards,
Geert
Index: WebdavCacheHandler.java
===================================================================
--- WebdavCacheHandler.java	(revision 21636)
+++ WebdavCacheHandler.java	(working copy)
@@ -83,6 +83,11 @@
             //cannot cache null or responses of unknown origine
             return;
         }
+        if (response.getResponseCode() >= 400) {
+           // will not cache error results. See RFC 2616 for definition of response codes.
+           return;
+        }
+
         try {
             WebdavRequest request = response.getRequest();
             EventValidity[] validities = EventValidityCalculator.calculate(request);
Index: WebdavServiceImpl.java
===================================================================
--- WebdavServiceImpl.java	(revision 21636)
+++ WebdavServiceImpl.java	(working copy)
@@ -220,5 +220,8 @@
             throw new IllegalStateException("Fetch by document ID has not been enabled.");
         }
     }
+    public void setWebdavCacheHandler(WebdavCacheHandler webdavCacheHandler) {
+       this.cache = webdavCacheHandler;
+    }
 
 }

Attachment: NoErrorResponseCachingServiceImpl.java
Description: NoErrorResponseCachingServiceImpl.java

********************************************
Hippocms-dev: Hippo CMS 6 development public mailinglist

Searchable archives can be found at:
MarkMail: http://hippocms-dev.markmail.org
Nabble: http://www.nabble.com/Hippo-CMS-f26633.html

Reply via email to