Skip to content

WebDAV authentication through Java

I’ve made a program which copies files from phone to windows folder. Connection to phone via WebDAV server. The problem is that I cannot connect to phone through Java until I open for ex. htpp:// in my windows explorer. After that phone is visible in Java. But that ruins all the meaning of my program.

Does anyone knows how to get access to phone through Java in the first place? Do I need to change something in registry or?

Thanks a lot!

P.S. copying procedure goes by:

File src = new File("\\" + address + "\DavWWWRoot\DCIM\Camera");

where address is “192.168.x.xx:8080”

and then it goes to Files.walkFileTree to copy all the files.



Well..I’ve made a bit different but most simplest way to solve my problem.

The whole problem was in this goddamn Windows OS. It has WebClient service on demand by default. I switched it to auto and now I can connect to phone (or any other WebDAV server) after reboot.

CMD code to switch to auto WebClient service:

sc config webclient start=auto

Run as Admin.

P.S. But I have to admit that my way (walkFileTree) to copy files from WebDAV server may be way far from the optimal.

User contributions licensed under: CC BY-SA
5 People found this is helpful