I have a set of events saved in my database (a very special database, so I can't use some popular open-source servers with, say, MySQL). Now I want to build a CalDav server (by Java) so that a user can connect his calendar client to it to retrieve or modify events. I'm new to this so have a lot of questions, hope you guys help me out.
What are the general steps?
Do I need to offer a servlet? If yes, then what must I return for a request? a JSON or XML or .ics file?
When a user subscribe to my calendar, does that mean that his client will pull my server (call the servlet) after an interval.
Update: this is 1-year old question since I first asked but I got quite some upvotes, so I'm obliged to provide some info: I ended up using Milton library http://milton.io/, it abstracts away the servlets, you just have to write functions to return data. The author of the library is quite helpful and informative. The end-result: our caldav server has worked.
I also accept Evert's answer.
To setup CalDAV, simply go to the “Mail, Contacts, and Calendars” page under “Setting”, click “Add Account”, click “Other”, and click “Add CalDAV Account”. Enter the URL to the CalDAV server, followed by the username and a calendar name, then enter the username and password.
About the Outlook CalDav SynchronizerOutlook CalDav Synchronizer is a free Outlook Plugin, which synchronizes events, tasks and contacts between Outlook and Google, SOGo, Nextcloud or any other CalDAV or CardDAV server. Supported Outlook versions are Office 365, 2019, 2016, 2013, 2010 and 2007.
Google provides a CalDAV interface that you can use to view and manage calendars using the CalDAV protocol.
CalDAV is a protocol extension for WebDAV and can used to manipulate data in the iCalendar format. So CalDAV is like the HTTP for calendar stuff, and iCalendar is like HTML. People on the internet use the terms icalendar and CalDAV interchangeably. "so caldav is like the http for calender stuff, and ical is like html".
Let me give it a try ;-)
As mentioned by Evert you need to implement a CalDAV server. Depending on what features you want to support, this is non-trivial and requires understanding of the relevant specs (iCalendar RFC 5545 and CalDAV 4791, WebDAV RFC 4918).
What are the general steps to implement a CalDAV server? You need HTTP entry-points to:
a) serve the account information (called principals in WebDAV), this includes under which URL the calendars of an account live
b) serve the list of calendars (called the calendar home, the principal info from a) points to this)
c) serve the actual calendars, that is, the events contained within those. CalDAV calendars are special WebDAV collections of 'iCalendar' resources. iCalendar is the format in which the events are represented.
Depending on what CalDAV features you want to support, this can be way more complex (e.g. server side scheduling). There are optimizations for faster syncs (sync-reports), or uploads, etc. You don't need all of it to get started.
As Evert says, how you implement the HTTP endpoints is your choice. Servlet's are one viable option. Principal information, calendar lists and URLs to items within a calendar are returned in (WebDAV) XML (multistatus responses). The actual content of an event needs to be returned in the iCalendar (.ics) format.
Yes.
Some CalDAV implementations also support Push (where the server can tell the client when new data is available), but that's not yet standardized and implementations vary a lot. The polling can be kept fast if your server implements CTags and sync-reports (RFC 6578).
Read the RFC: https://www.rfc-editor.org/rfc/rfc4791
Not just once, you want to at least read it top to bottom 4 times.
More than that, you should probably also read the RFC's for WebDAV, WebDAV ACL and iCalendar.
Any answer you would get here would be a repetition of what's in there, and attempting to simplify this is rather futile, because you really need a full understanding of most of the specification.
To answer your questions specifically:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With