-
-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot connect to Nextcloud #53
Comments
Hi, thanks for the feedback. Yes, I think it's a bug and at this stage I don't recommend using version 2.0.0-alpha1 as it had a major refactor and is probably still broken at this stage. You may have more success with release 1.0.5, but let me know if you see any other issues and I'll try to address them. https://search.maven.org/artifact/org.mnode.ical4j/ical4j-connector/1.0.5/jar I hope to release a new alpha build for 2.0.0 soon to fix some of these issues. P.S. And the specific error you are seeing is because |
Thank you for your quick reply! I have tried 1.0.5 and stumbled over another problem: My URL is of the form However, in How can I help to fix this? |
The hardest (most time-consuming) part at the moment is testing, so I think providing these bug reports is the best way to contribute. If you want to have a look at the code for v2 you can check out this branch: https://github.com/ical4j/ical4j-connector/tree/feature/refactor You'll note I am also splitting into a multi-module project so the coordinates for the next release will change, but hopefully the API won't change too much. I'll try to push out a new v2 release in a few days. |
The new structure looks good and the API (code examples in the README 🥳 ) seems much more accessible. Unfortunately I could not manage to build the library locally (missing dependencies?):
Intellij, however, could build. (not a gradle expert here) Build instructions in the README would be very helpful to verify that I am doing the right thing. |
Yup sorry I have a few uncommitted changes locally. I've just added the dependencies that should help it to build. I have a couple more changes coming based on your earlier feedback, just trying to validate/test the change before committing it. |
Thank you! The current branch ends up like this:
This seems to be a JDK17 thing? I have:
|
Ok, I am still running jdk11 locally. I've just added multiple JVMs to the build, and disabled module support for now (for java 8 compatibility). Let me know if it still fails locally with jdk17 and I'll investigate further. |
Sadly it still doesn't work. |
Thanks to your hint in #54 I got a running test frame: DavClientFactory clientFactory = new DavClientFactory().withPreemptiveAuth(true).withFollowRedirects(true);
CalDavSupport caldav = clientFactory.newInstance(
"https://nextcloud.exampe.com/remote.php/dav/"
);
DefaultDavClient client = (DefaultDavClient) caldav;
List<SupportedFeature> features = client.begin("alice", "secret".toCharArray());
// /remote.php/caldav/calendars/alice/personal/
Calendar calendar = caldav.getCalendar("alice/personal"); The calendar call goes to I guess some kind of custom path resolution is needed? (Also I have to cast to the dav client and call begin, otherwise the calendar call fails with a missing HTTP client) |
Yes, the
So to have the request go to
The authentication does seem a bit clunky, I've just added support for credentials to the DavClientFactory, e.g:
If you don't supply a credentials provider it will initialise the http client without credentials. |
The new Auth API makes it much more accessible. :) I am using credentialsProvider.setCredentials(AuthScope.ANY, credentials); to save myself from extracting host/port information. I could not set the proper repository path before, because then the principal for authentication would not be found. This problem seems to be solved and I am accessing a calendar path that does not lead to an error during PROPFIND. However, the next call is a
CalDAV should be working because I am using DAVx to synchronize with my phone and extracted the URL from these calls. However, DAVx only does the PROPFIND call. |
A thought regarding that: |
A GET request should be the simplest one, as I don't think there is anything specific to DAV for this. Unless there are some required headers we are missing.. (or the path is wrong). I'll check for any examples in the Nextcloud documentation to confirm. Also, you may be aware that DAVx has an extensive list of configurations for different CalDAV providers: https://www.davx5.com/tested-with/nextcloud I think I will be using this as a basis for validating the ical4j-connector implementation. |
I am trying to connect to NextCloud, but run into some trouble.
Setup
I'm using these dependencies:
My test code looks like this:
The initial login (connect) works fine.
Problems
Then two things happen:
1) Path resolution
store.getCollections
does a call toCalDavCalendarStore.findCalendarHomeSet
with thepropfindUri == "https://nc.example.com/remote.php/dav/principals/users/alice/"
DefaultDavClient.resolvePath
with the same path. Here therepositoryPath
is added, transforming the correct path into/remote.php/dav/https://nc.example.com/remote.php/dav/principals/users/alice/
- not what we want.path
in the debugger, so that the initial path will be returned as/remote.php/dav/principals/alice
. I do not really understand what this method is supposed to do when a complete path is already provided.With my change, the path following call works out.
2) Class cast exception
CalDavCalendarStore.findCalendarHomeSet
is the following line:What to do?
At this point I am not sure how to proceed:
PathResolver
? What are the right settings for NextCloud?Unfortunately I cannot find any example code. I appreciate that the project is still under development, but at this point I cannot see how things are supposed to be and how to proceed.
Any help woudl be greatly appreciated!
The text was updated successfully, but these errors were encountered: