a-schild/nextcloud-java-api

Exceptions with NC 16

sunchezz89 opened this issue · 8 comments

With the current version i cannnot make a connection to my nextcloud instance wich is a NC 16.0.1.
I have tested this with every possible parameter for NextcloudConnector.
Either your API is complaining about an invalid SSL message (even if the boolean for ssl is set to false), or a bad request, 405, or 400 is catched.

Implementing the Sardine connection by myself with the same config, works instead.

String url = "subdomain.domain.tld";
client = SardineFactory.begin();
client.setCredentials(u, p);
client.enablePreemptiveAuthentication(url);
client.list("https://" + url + "/");

It seems that you are doing something with the uri, is that correct?

Can you please show the code you are using with the NC api to connect to your server?
In the URL the remote.php/webdav/ and in other parts the ocs/v1.php/apps/files_sharing/api/v1/ is handled by the library.

That's the code which did not work.

String server = "subdomain.domain.tld";
NextcloudConnector nc= new NextcloudConnector(server, true, 80, user, pw);
System.out.println(nc.listFolderContent());

With using https on port 80 it is very probably that it won't work, unless you configured your server to also accept https on port 80.

The default https port is 443.

public NextcloudConnector(String serverName, boolean useHTTPS, int port, String userName, String password)

I know. Thanks :)

  1. i configured the server this way and
  2. i tired every option without ssl on port 80, with ssl on 443, with a different URL notation... Everything.

And like i said, using the same configuration with plain Sardine, worked.

Without some code to reproduce the problem we can't help you.
Will close this issue in 1-2 weeks

I have the same trouble.
It seems the trouble comes from src/main/java/org/aarboard/nextcloud/api/webdav/AWebdavHandler.java buildWebdavPath method. URIBuilder returns a path like this https://server:443remote.php/webdav/folder_name
URI path is missing "/" before remote.php/webdav

This impact every webdav calls

This issue id definitively not comming from this libarry, but from the http client URIBuilder.
Looks like there is a change in behaviour in some of the 4.5.2 - 4.5.9 versions.

In nextcloud api we now specify the version to 4.5.10 which does work as intended.
Could you please test with the new 11.1.0-SNAPSHOT release?

If it still fails, please check what httpclient version your project is including

Closing because no answer on question