2015-11-03 82 views
0

我想爲我的應用程序開發一個簡單的CalDAV服務器,並且在這方面我試圖服務來自日曆客戶端的初始PROPFIND請求。WebDAV屬性返回請求中,即使設置後

方法::PROPFIND /日曆/用戶/ HTTP/1.1

爲一組屬性的日曆客戶端請求(如下所示),以由所述服務器響應於所述請求來設定

請求頭

Accept-encoding gzip, deflate 
Accept */* 
Connection keep-alive 
Prefer return=minimal 
Host 192.168.0.12:8080 
Brief t 
User-agent Mac+OS+X/10.10.5 (14F27) CalendarAgent/316.1 
Depth 0 
Authorization Basic YWRtaW46cGFzc3dvcmQ= 
Accept-language en-us 
Content-type text/xml 
Content-length 743 

請求體

<?xml version="1.0" encoding="UTF-8"?> 
<A:propfind xmlns:A="DAV:"> 
<A:prop> 
    <B:calendar-home-set xmlns:B="urn:ietf:params:xml:ns:caldav"/> 
    <B:calendar-user-address-set xmlns:B="urn:ietf:params:xml:ns:caldav"/> 
    <A:current-user-principal/> 
    <A:displayname/> 
    <C:dropbox-home-URL xmlns:C="http://calendarserver.org/ns/"/> 
    <C:email-address-set xmlns:C="http://calendarserver.org/ns/"/> 
    <C:notification-URL xmlns:C="http://calendarserver.org/ns/"/> 
    <A:principal-collection-set/> 
    <A:principal-URL/> 
    <A:resource-id/> 
    <B:schedule-inbox-URL xmlns:B="urn:ietf:params:xml:ns:caldav"/> 
    <B:schedule-outbox-URL xmlns:B="urn:ietf:params:xml:ns:caldav"/> 
    <A:supported-report-set/> 
</A:prop> 
</A:propfind> 

至於上述PROPFIND請求我設置響應的響應如下所示:

響應頭

Accept-encoding gzip, deflate 
Accept */* 
Connection keep-alive 
Prefer return=minimal 
Host 192.168.0.12:8080 
Brief t 
User-agent Mac+OS+X/10.10.5 (14F27) CalendarAgent/316.1 
Depth 0 
Authorization Basic YWRtaW46cGFzc3dvcmQ= 
Accept-language en-us 
Content-type text/xml 
Content-length 743 

響應體

String response = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"+ 
      "<A:multistatus xmlns:A=\"DAV:\" xmlns:cs=\"http://calendarserver.org/ns/\">" + 
      "<A:response>" + 
       "<A:href>/calendars/user/</A:href>" + 
       "<A:propstat>" + 
        "<A:prop>" + 
         "<B:calendar-home-set xmlns:B=\"urn:ietf:params:xml:ns:caldav\"><B:href>/admin/calendar/test/</B:href></B:calendar-home-set>"+ 
         "<B:calendar-user-address-set xmlns:B=\"urn:ietf:params:xml:ns:caldav\"/><A:href>mailto:[email protected]</A:href></B:calendar-user-address-set>"+ 
         "<A:current-user-principal><A:href>/principals/users/admin</A:href></A:current-user-principal>"+ 
         "<A:displayname>Test calendar</A:displayname>"+ 
         "<A:principal-collection-set><A:href>/principals/users/</A:href><A:href>/principals/groups/</A:href></A:principal-collection-set>"+ 
         "<A:principal-URL><A:href>http://192.168.0.12/principals/users/admin/</A:href></A:principal-URL>"+ 
         "<A:supported-report-set xmlns:n2=\"urn:inverse:params:xml:ns:inverse-dav\" xmlns:n3=\"urn:ietf:params:xml:ns:carddav\" xmlns:A=\"DAV:\" xmlns:n1=\"urn:ietf:params:xml:ns:caldav\">"+ 
         "<A:supported-report><A:report><n1:calendar-query/></A:report></A:supported-report>"+ 
         "<A:supported-report><A:report><n1:calendar-multiget/></A:report></A:supported-report>"+ 
         "<A:supported-report><A:report><n2:acl-query/></A:report></A:supported-report>"+ 
         "<A:supported-report><A:report><A:sync-collection/></A:report></A:supported-report>"+ 
         "<A:supported-report><A:report><A:expand-property/></A:report></A:supported-report>"+ 
         "<A:supported-report><A:report><n3:addressbook-query/></A:report></A:supported-report>"+ 
         "<A:supported-report><A:report><n1:free-busy-query/></A:report></A:supported-report>"+ 
         "</A:supported-report-set>"+  
         "<B:schedule-inbox-URL xmlns='urn:ietf:params:xml:ns:caldav'><href xmlns='DAV:'>/calendars/__uids__/admin/inbox/</href></B:schedule-inbox-URL>"+ 
         "<B:schedule-outbox-URL xmlns='urn:ietf:params:xml:ns:caldav'><href xmlns='DAV:'>/calendars/__uids__/admin/outbox/</href></B:schedule-outbox-URL>"+ 
         "<C:dropbox-home-URL xmlns='http://calendarserver.org/ns/'><href xmlns='DAV:'>/calendars/__uids__/admin/dropbox/</href></C:ropbox-home-URL>"+ 
        "</A:prop>" + 
        "<A:status>HTTP/1.1 200 OK</A:status>" + 
       "</A:propstat>" + 
      "</A:response>" + 
     "</A:multistatus>"; 

將響應發送給客戶端後,客戶端再次發回相同的屬性(並非全部 - 如下所示)。

<?xml version="1.0" encoding="UTF-8"?> 
<A:propfind xmlns:A="DAV:"> 
    <A:prop> 
    <A:current-user-principal/> 
    <A:principal-collection-set/> 
    </A:prop> 
</A:propfind> 

所以任何人都可以讓我知道我在哪裏設置這些屬性出錯?

+0

特別可能沒有任何錯誤。有些客戶只是有點嘮叨。 – Evert

+0

Evert因爲我再次收回這些請求,我無法繼續前進。也就是說,提供日曆回家或下一步。我該如何解決? – Hoysala

+0

您可以分享_actual_完整回覆(包括標題?)。你可能想要嘗試的一件事是使用相對uri而不是絕對的。 – Evert

回答

0

正如Evert在評論部分提到的那樣,客戶端有點健談。經過幾次觀察,甚至我發現相同。

相關問題