[Cosmo-dev] Caldav4j: patch to latest RFC

Roberto Polli rpolli at babel.it
Fri Sep 28 07:05:07 PDT 2007


Hi all,

the following patch goes closer to the latest RFC. 
as of  http://www.ietf.org/rfc/rfc4791.txt 

   CalDAV servers are REQUIRED to support the "i;ascii-casemap" and
   "i;octet" collations, as described in [RFC4790], and MAY support
   other collations.

so I kludged the code to support at least the collation "i;ascii-casemap".

*anyway it seems tha client and server should negotiate the collation.*

The following patch sets the required collation attribute in the xml: without 
this the library doesn't work with bedework.

Kludge/Patch follows, I'd like to ear from you...
tia,
R.
--------------



[rpolli at revolver scooby]$ svn diff -r HEAD 
src/main/java/org/osaf/caldav4j/model/request/TextMatch.java
Index: src/main/java/org/osaf/caldav4j/model/request/TextMatch.java
===================================================================
--- src/main/java/org/osaf/caldav4j/model/request/TextMatch.java        
(revision 5569)
+++ src/main/java/org/osaf/caldav4j/model/request/TextMatch.java        
(working copy)
@@ -40,14 +40,20 @@
     public static final String ATTR_VALUE_YES = "yes";
     public static final String ATTR_VALUE_NO  = "no";

+    public static final String ATTR_COLLATION = "collation"; // rpolli
+    private String collation = null; // rpolli
+
     private String caldavNamespaceQualifier = null;
     private String textToMatch = null;
     private Boolean caseless = null;

     public TextMatch(String caldavNamespaceQualifier, Boolean caseless,
             String textToMatch) {
         this.caldavNamespaceQualifier = caldavNamespaceQualifier;
         this.caseless = caseless;
+       // this.collation = "i;octet"; // rpolli
+        this.collation = "i;ascii-casemap"; // rpolli
         this.textToMatch = textToMatch;

     }
@@ -74,12 +80,16 @@

     protected Map<String, String> getAttributes() {
         Map<String, String> m = null;
+        m = new HashMap<String, String>();
+
         if (caseless != null) {
-            m = new HashMap<String, String>();
             m.put(ATTR_CASELESS, caseless.booleanValue() ? ATTR_VALUE_YES
                     : ATTR_VALUE_NO);
-
         }
+
+        if (collation != null) {
+               m.put(ATTR_COLLATION, collation);
+        }
         return m;
     }



-- 

Roberto Polli
Babel S.r.l. - http://www.babel.it
Tel. +39.06.91801075 - fax +39.06.91612446
P.zza S.Benedetto da Norcia, 33 - 00040 Pomezia (Roma)

"Il seguente messaggio contiene informazioni riservate. Qualora questo 
messaggio fosse da Voi ricevuto per errore, Vogliate cortesemente darcene 
notizia a mezzo e-mail. Vi sollecitiamo altresì a distruggere il messaggio 
erroneamente ricevuto. Quanto precede Vi viene chiesto ai fini del rispetto 
della legge in materia di protezione dei dati personali."


More information about the cosmo-dev mailing list