Caldav: 3132513, implement well-known url, see http://tools.ietf.org/html/draft-daboo-srv-caldav-10
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1623 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
75328413c8
commit
35acd60fcc
|
@ -205,6 +205,8 @@ public class CaldavConnection extends AbstractConnection {
|
|||
handleFolder(request);
|
||||
} else if (request.isPath(1, "directory")) {
|
||||
sendDirectory(request);
|
||||
} else if (request.isPath(1, ".well-known")) {
|
||||
sendWellKnown(request);
|
||||
} else {
|
||||
sendUnsupported(request);
|
||||
}
|
||||
|
@ -885,6 +887,18 @@ public class CaldavConnection extends AbstractConnection {
|
|||
response.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Send caldav response for /.well-known/ request.
|
||||
*
|
||||
* @param request Caldav request
|
||||
* @throws IOException on error
|
||||
*/
|
||||
public void sendWellKnown(CaldavRequest request) throws IOException {
|
||||
HashMap<String, String> headers = new HashMap<String, String>();
|
||||
headers.put("Location", "/");
|
||||
sendHttpResponse(HttpStatus.SC_MOVED_PERMANENTLY, headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Caldav principal response.
|
||||
*
|
||||
|
|
|
@ -334,4 +334,13 @@ public class TestCaldav extends AbstractDavMailTestCase {
|
|||
httpClient.executeMethod(moveMethod);
|
||||
}
|
||||
|
||||
public void testWellKnown() throws IOException {
|
||||
DavPropertyNameSet davPropertyNameSet = new DavPropertyNameSet();
|
||||
davPropertyNameSet.add(DavPropertyName.create("current-user-principal", Namespace.getNamespace("DAV:")));
|
||||
PropFindMethod method = new PropFindMethod("/.well-known/caldav", davPropertyNameSet, 0);
|
||||
httpClient.executeMethod(method);
|
||||
assertEquals(HttpStatus.SC_MOVED_PERMANENTLY, method.getStatusCode());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue