Cosmo Calendar Server implements the server side of the CalDAV protocol.
Java HTML Perl
Switch branches/tags
cosmo-multimodule-2.1.5 cosmo-multimodule-2.1.4 cosmo-multimodule-2.1.3 cosmo-multimodule-2.1.2 cosmo-multimodule-2.1.1 cosmo-multimodule-2.1.0 cosmo-multimodule-2.0.1 cosmo-multimodule-2.0.0 cosmo-multimodule-1.6.3 cosmo-multimodule-1.6.2 cosmo-multimodule-1.6.1 cosmo-multimodule-1.6.0 cosmo-multimodule-1.5.8 cosmo-multimodule-1.5.7 cosmo-multimodule-1.5.6 cosmo-multimodule-1.5.5 cosmo-multimodule-1.5.4 cosmo-multimodule- cosmo-multimodule- cosmo-multimodule- cosmo-multimodule-1.5.3 cosmo-multimodule-1.5.2 cosmo-multimodule-1.5.1 cosmo-multimodule-1.5.0 cosmo-multimodule-1.4.23 cosmo-multimodule-1.4.21 cosmo-multimodule-1.4.20 cosmo-multimodule-1.4.19 cosmo-multimodule-1.4.18 cosmo-multimodule-1.4.17 cosmo-multimodule-1.4.16 cosmo-multimodule-1.4.15 cosmo-multimodule-1.4.14 cosmo-multimodule-1.4.13 cosmo-multimodule-1.4.12 cosmo-multimodule-1.4.11 cosmo-multimodule-1.4.10 cosmo-multimodule-1.4.9 cosmo-multimodule-1.4.8 cosmo-multimodule-1.4.7 cosmo-multimodule-1.4.6 cosmo-multimodule-1.4.5 cosmo-multimodule-1.4.3 cosmo-multimodule-1.4.2 cosmo-multimodule-1.4.1 cosmo-multimodule-1.4.0 cosmo-multimodule-1.3.0 cosmo-multimodule-1.2.1 cosmo-multimodule-1.2.0 cosmo-multimodule-1.1.0 cosmo-multimodule-1.0.29 cosmo-multimodule-1.0.28 cosmo-multimodule-1.0.27 cosmo-multimodule-1.0.26 cosmo-multimodule-1.0.25 cosmo-multimodule-1.0.24 cosmo-multimodule-1.0.23 cosmo-multimodule-1.0.22 cosmo-multimodule-1.0.21 cosmo-multimodule-1.0.20 cosmo-multimodule-1.0.19 cosmo-multimodule-1.0.18 cosmo-multimodule-1.0.17 cosmo-multimodule-1.0.16 cosmo-multimodule-1.0.15 cosmo-multimodule-1.0.14 cosmo-multimodule-1.0.13 cosmo-multimodule-1.0.12 cosmo-multimodule-1.0.11 cosmo-multimodule-1.0.10-RC cosmo-multimodule-1.0.9-RC cosmo-multimodule-1.0.8 cosmo-multimodule-1.0.7 cosmo-multimodule-1.0.6-RC cosmo-multimodule-1.0.5 cosmo-multimodule-1.0.4 cosmo-multimodule-1.0.3 cosmo-multimodule-1.0.2 cosmo-multimodule-1.0.1 cosmo-multimodule-0.99 cosmo-multimodule-0.98 cosmo-multimodule-0.97 cosmo-multimodule-0.96 cosmo-multimodule-0.95 cosmo-multimodule-0.94 cosmo-multimodule-0.93 cosmo-api-0.92 cosmo-api-0.91 cosmo-api-0.9
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
cosmo-webapp Use 1.6.2 parent version. Sep 27, 2017
LICENSE Initial commit May 13, 2015
checkstyle-suppressions.xml Initial commit May 13, 2015
checkstyle.xml Initial commit May 13, 2015



Cosmo Calendar Server is part of an open source project called Chandler which provides calendaring features, task and note management. Cosmo implements CalDAV protocol. It is being used as Calendar Server solution for WEB.DE,, and brands.

This project contains only CalDAV core part from Chandler with its dependencies up to date (initial project being closed in 2008).

It also brings a new approach in such a way that Cosmo is a CalDAV runtime environment. The project provides an API that contains abstractions over CalDAV and iCal specific objects, services implemented in Cosmo Core but also accessible to developers and a plugin mechanism that allows developers to write custom logic without having to alter Cosmo Core code.

Main parts

There are two main logical components, each of them residing in its own artifact: cosmo-api and cosmo-core.

cosmo-api contains:

  • interfaces which are contracts between the CalDAV runtime environment and an implementation of such an interface
  • externalizable services definitions (interfaces) whose actual implementations are placed in cosmo-core and can be injected (externalized) into client components
  • POJOs and interfaces that are abstractions of CalDAV components
  • annotations that are used to specify that an implementation of some contract must be plugged into the CalDAV runtime environment
  • annotations that tells the runtime environment container that it should inject some (public) service implementation.

cosmo-core is the actual CalDAV server and runtime environment for developer custom components. It looks up for such components at application context startup and registers them in order to be called during requests. It also injects public services into developer components.

Technical requirements

The application that uses cosmo-api and cosmo-core must be a Java Servlet 3.0 application (and be deployed in a compliant Servlet 3.0 container).

Setting up a CalDAV server with cosmo-api and cosmo-core

At least one (concrete) implementation of annotated with @CalendarSecurity must be provided. Exactly one (concrete) implementation of org.unitedinternet.cosmo.db.DataSourceProvider annotated with @CalendarRepository must be provided.

Other components can exist without a restriction. All of these are looked up in a Spring context (if exists), otherwise are instantiated directly.

###Building and running the existing demo project The cosmo-webapp application is just for demoing purposes. To launch it, in the project's root directory just run mvn tomcat7:run-war -Dexample=true. The calendar server will be packaged, tested and run. It will be available for CalDAV requests at http://localhost:8080/cosmo/dav/. The application simply creates a user with an empty calendar called 'calendar' if the user doesn't exist and then you can perform CalDAV requests to URI /cosmo/dav/<username>/calendar/ where <username> is the username you provided for login.

###Example of Spring Application that creates a user if he doesn't exist:




    <bean id="authenticationProvider" class=""/>
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" lazy-init="true" destroy-method="close">
         <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
         <property name="url" value="jdbc:mysql://localhost/os?autoReconnect=true"/>
         <property name="username" value="os"/> 
         <property name="password" value="*" />
         <property name="maxActive" value="100"/> 
         <property name="maxIdle" value="20" />
         <property name="maxWait" value="10000"/>
         <property name="poolPreparedStatements" value="true" />
         <property name="defaultAutoCommit" value="false" />
    <bean id="dataSourceProviderImpl" class="com.unitedinternet.calendar.repository.DataSourceProviderImpl">
        <constructor-arg ref="dataSource"/>
        <constructor-arg value="MySQL5InnoDB"/>

The required authentication provider which in our case simply (for example's sake) considers each user a valid one is the class

public class DummyAuthenticationProvider implements AuthenticationProvider{
	public Authentication authenticate(Authentication authentication) throws AuthenticationException {
	    String userName = authentication.getName();
		return new UsernamePasswordAuthenticationToken(userName, "somePassword");

If a user component is not found in the Spring application context, it will be instantiated. The same happens to the successful authentication listener that creates a calendar user if he doesn't already exist with the given credentials after a successful authentication. (Please keep in mind that in this example each authentication is valid):

public class UserCreationAuthenticationListener implements SuccessfulAuthenticationListener{
	private UserService userService;
	private EntityFactory entityFactory;
	private ContentService contentService;
	public void onSuccessfulAuthentication(Authentication authentication) {
	public void setEntityFactory(EntityFactory entityFactory) {
		his.entityFactory = entityFactory;
	public void setContentService(ContentService contentService) {
		this.contentService = contentService;

The @CalendarSecurity annotation and implementation of SuccessfulAuthenticationListener tells the runtime that an instance of this class must be invoked after a successful authentication. @Provided annotation associated with an externalizable service tells the container that it must inject the implementation into that instance variable. The injection is available via setter and via field.