1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-13 03:02:22 -05:00

Caldav: fix principal-URL response

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1747 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2011-07-26 06:49:26 +00:00
parent e8c1b24f4b
commit 4075baecda
2 changed files with 15 additions and 2 deletions

View File

@ -940,7 +940,7 @@ public class CaldavConnection extends AbstractConnection {
response.startPropstat(); response.startPropstat();
if (request.hasProperty("principal-URL")) { if (request.hasProperty("principal-URL")) {
response.appendProperty("D:principal-URL", "/principals/" + prefix + '/' + principal); response.appendHrefProperty("D:principal-URL", "/principals/" + prefix + '/' + principal);
} }
if (request.hasProperty("calendar-home-set")) { if (request.hasProperty("calendar-home-set")) {

View File

@ -342,9 +342,11 @@ public class TestCaldav extends AbstractDavMailTestCase {
httpClient.executeMethod(moveMethod); httpClient.executeMethod(moveMethod);
} }
public void testWellKnown() throws IOException { public void testWellKnown() throws IOException, DavException {
DavPropertyNameSet davPropertyNameSet = new DavPropertyNameSet(); DavPropertyNameSet davPropertyNameSet = new DavPropertyNameSet();
davPropertyNameSet.add(DavPropertyName.create("current-user-principal", Namespace.getNamespace("DAV:"))); davPropertyNameSet.add(DavPropertyName.create("current-user-principal", Namespace.getNamespace("DAV:")));
davPropertyNameSet.add(DavPropertyName.create("principal-URL", Namespace.getNamespace("DAV:")));
davPropertyNameSet.add(DavPropertyName.create("resourcetype", Namespace.getNamespace("DAV:")));
PropFindMethod method = new PropFindMethod("/.well-known/caldav", davPropertyNameSet, 0); PropFindMethod method = new PropFindMethod("/.well-known/caldav", davPropertyNameSet, 0);
httpClient.executeMethod(method); httpClient.executeMethod(method);
assertEquals(HttpStatus.SC_MOVED_PERMANENTLY, method.getStatusCode()); assertEquals(HttpStatus.SC_MOVED_PERMANENTLY, method.getStatusCode());
@ -359,4 +361,15 @@ public class TestCaldav extends AbstractDavMailTestCase {
assertEquals(HttpStatus.SC_MULTI_STATUS, method.getStatusCode()); assertEquals(HttpStatus.SC_MULTI_STATUS, method.getStatusCode());
} }
public void testPropfindRoot() throws IOException, DavException {
DavPropertyNameSet davPropertyNameSet = new DavPropertyNameSet();
davPropertyNameSet.add(DavPropertyName.create("current-user-principal", Namespace.getNamespace("DAV:")));
davPropertyNameSet.add(DavPropertyName.create("principal-URL", Namespace.getNamespace("DAV:")));
davPropertyNameSet.add(DavPropertyName.create("resourcetype", Namespace.getNamespace("DAV:")));
PropFindMethod method = new PropFindMethod("/", davPropertyNameSet, 0);
httpClient.executeMethod(method);
assertEquals(HttpStatus.SC_MULTI_STATUS, method.getStatusCode());
method.getResponseBodyAsMultiStatus();
}
} }