Re: WebObjects, Java and CalDAV, getting in trouble
Re: WebObjects, Java and CalDAV, getting in trouble
- Subject: Re: WebObjects, Java and CalDAV, getting in trouble
- From: Pascal Robert <email@hidden>
- Date: Tue, 30 Jun 2009 06:53:48 -0400
What's the output of the DAV connection is throwing out? By default,
the log4j level is DEBUG so you should see the traffic between iCal
and your WO app.
Hello all,
I'm tryng to do a simple parsing test on a CalDav calendar...
This is my example code just used for testing
in red the console output
Anyone have suggestions?
Many Thanks
Amedeo
public void parse() throws Exception {
Protocol myHTTPS = new Protocol( "http", new
DefaultProtocolSocketFactory(), 80 );
CalDavCalendarStore store = new
CalDavCalendarStore("MacTI","calendar.confindustria.chieti.it",
8008,myHTTPS,PathResolver.ICAL_SERVER);
store.connect("amedeomantica","password".toCharArray());
ArrayList myList = store.getCollections();
System.out.println( "size= " + myList.size()); ---> Actually
outputs: size= 1
CalDavCalendarCollection collection =
(CalDavCalendarCollection) myList.get(0); --> Size is 1 so I
manually put 0 just for testing
System.out.println( "collectionID= " + collection.getId() );
----> Actually outputs: size= 1
System.out.println( "collectionLenght= " +
collection.getEvents()); ----> Actually outputs: collectionID= /
calendars/__uids__/CFFB9113-FE25-4B47-B022-9C5CA62674DB/calendar/
and is CORRECT
Calendar[] calendars = collection.getEvents();
System.out.println( "count= " + new
NSArray(calendars).count()); ----> Actually outputs 0, this is not
TRUE, should be 2
if (calendars != null) {
for (int iter = 0; iter < calendars.length; iter++) {
// Display the start time of the event
System.out.println(iter);
System
.out
.println
(calendars
[iter].getComponent("VEVENT").getProperty(Property.DTSTART));
}
}
}
On 27/mar/09, at 16:54, Pascal Robert wrote:
I'm playing with iCal4j-connector, and it works ok. It won't find
the calendar-home-set from the principals, but I was able to find
the events stored in my CalendarServer installation with the
following code :
import net.fortuna.ical4j.connector.ObjectNotFoundException;
import net.fortuna.ical4j.connector.ObjectStoreException;
import net.fortuna.ical4j.connector.dav.CalDavCalendarCollection;
import net.fortuna.ical4j.connector.dav.CalDavCalendarStore;
import net.fortuna.ical4j.model.Calendar;
import net.fortuna.ical4j.model.Property;
import org.apache.commons.httpclient.protocol.Protocol;
import
org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory;
Protocol myHTTPS = new Protocol( "http", new
DefaultProtocolSocketFactory(), 80 );
CalDavCalendarStore store = new
CalDavCalendarStore("MacTI","localhost",8008,myHTTPS,"/calendars");
store.connect("admin","password".toCharArray());
// it only works when checking a calendar collections, the user
collections won't work
CalDavCalendarCollection collection = store.getCollection("/users/
admin/calendar/");
Calendar[] calendars = collection.getCalendars();
if (calendars != null) {
for (int iter = 0; iter < calendars.length; iter++) {
// Display the start time of the event
NSLog
.out
.appendln
(calendars
[iter].getComponent("VEVENT").getProperty(Property.DTSTART));
}
}
So for reading events, it should works fine.
Hi Amedeo,
Take a look at [1]. We use it for our calendar component and it
works pretty well.
[1]ical4j.sourceforge.net/
Cheers,
Henrique
Amedeo Mantica wrote:
Hello all,
Anyone know if there is a Library, a Class, a Framework to access
CalDAV calendars ?
I need just to read data ad display on the web, no editing
Regards
Amedeo
://www.linkedin.com/in/macti
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
-------------------------------------------------------
Pascal Robert
http://www.macti.ca | http://www.linkedin.com/in/macti
Skype | Twitter | AIM/iChat : MacTICanada
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden