Update deps to Funambol 8.7
[jgroupdav.git] / src / main / java / net / bionicmessage / groupdav / CalDAVFormatter.java
blob9e4f98c41f97a9c15071286ecbf121abc1c585c7
1 /*
2 * Redistribution and use in source and binary forms, with or without modification, are
3 * permitted provided that the following conditions are met:
4 *
5 * 1. Redistributions of source code must retain the above copyright notice, this list of
6 * conditions and the following disclaimer.
7 *
8 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
9 * of conditions and the following disclaimer in the documentation and/or other materials
10 * provided with the distribution.
12 * THIS SOFTWARE IS PROVIDED BY Mathew McBride ``AS IS'' AND ANY EXPRESS OR IMPLIED
13 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
14 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> OR
15 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
16 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
17 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
18 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
19 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
20 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 * The views and conclusions contained in the software and documentation are those of the
23 * authors and should not be interpreted as representing official policies, either expressed
24 * or implied, of Mathew McBride.
26 package net.bionicmessage.groupdav;
28 import java.io.UnsupportedEncodingException;
29 import java.util.List;
31 /**
33 * @author matt
35 public class CalDAVFormatter implements DAVReportFormatter {
37 public byte[] formatReport(List<String> urlsToGet) throws UnsupportedEncodingException {
38 StringBuffer request = new StringBuffer();
39 request.append("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
40 request.append("\r\n<C:calendar-multiget xmlns:D=\"DAV:\" \r\n");
41 request.append("xmlns:C=\"urn:ietf:params:xml:ns:caldav\"> ");
42 request.append("\r\n<D:prop>\r\n<D:getetag/>\r\n<C:calendar-data/>");
43 request.append("\r\n</D:prop>");
44 for (String s : urlsToGet) {
45 request.append("<D:href>");
46 request.append(s);
47 request.append("</D:href>");
49 request.append("</C:calendar-multiget>");
50 return request.toString().getBytes("UTF-8");