From ef4ec591513b39a989b720613d7e946477966cda Mon Sep 17 00:00:00 2001 From: mguessan Date: Mon, 18 Jul 2011 21:15:48 +0000 Subject: [PATCH] Caldav: send principal-URL for OSX Lion git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1739 3d1905a2-6b24-0410-a738-b14d5a86fcbd --- src/java/davmail/caldav/CaldavConnection.java | 4 ++++ src/test/davmail/caldav/TestCaldav.java | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/src/java/davmail/caldav/CaldavConnection.java b/src/java/davmail/caldav/CaldavConnection.java index 5d029b33..34d7d230 100644 --- a/src/java/davmail/caldav/CaldavConnection.java +++ b/src/java/davmail/caldav/CaldavConnection.java @@ -924,6 +924,10 @@ public class CaldavConnection extends AbstractConnection { response.startResponse(URIUtil.encodePath("/principals/" + prefix + '/' + principal)); response.startPropstat(); + if (request.hasProperty("principal-URL")) { + response.appendProperty("D:principal-URL", "/principals/" + prefix + '/' + principal); + } + if (request.hasProperty("calendar-home-set")) { if ("users".equals(prefix)) { response.appendHrefProperty("C:calendar-home-set", "/users/" + actualPrincipal + "/calendar/"); diff --git a/src/test/davmail/caldav/TestCaldav.java b/src/test/davmail/caldav/TestCaldav.java index 4cf09d5f..6b064a78 100644 --- a/src/test/davmail/caldav/TestCaldav.java +++ b/src/test/davmail/caldav/TestCaldav.java @@ -350,5 +350,13 @@ public class TestCaldav extends AbstractDavMailTestCase { assertEquals(HttpStatus.SC_MOVED_PERMANENTLY, method.getStatusCode()); } + public void testPrincipalUrl() throws IOException, DavException { + DavPropertyNameSet davPropertyNameSet = new DavPropertyNameSet(); + davPropertyNameSet.add(DavPropertyName.create("principal-URL", Namespace.getNamespace("DAV:"))); + PropFindMethod method = new PropFindMethod("/principals/users/"+session.getEmail(), davPropertyNameSet, 0); + httpClient.executeMethod(method); + method.getResponseBodyAsMultiStatus(); + assertEquals(HttpStatus.SC_MULTI_STATUS, method.getStatusCode()); + } }