Reputation: 1074
in my app I have a NanoHttpd server https://github.com/NanoHttpd/nanohttpd but now I want to add a webdav support. I'm looking for some tutorial or advices to do that, but I found only jackrabbit library without any tutorial or guide. Have you some suggest to give to me ?
Upvotes: 3
Views: 1284
Reputation: 3097
Since 29 Jan. 2016, NanoHTTPD supports WebDAV verbs. You just want to pull the last version and handle the new verbs.
Upvotes: 1
Reputation: 854
A few people have integrated milton into their android apps to add webdav server capability. See here - http://milton.io
Links to tutorials are on the home page. Nothing specific for android, but it should be straight forward.
(as per comment below regarding nanohttpd) To integrate with nanohttpd you would need to implement the Request and Response interfaces, to wrap data from nanohttpd. And you would need to create an instance of miltons HttpManager, and pass the request and response objects to its process method for each request.
Note that milton is integrated with the Simple http container out of the box (called Simpleton), so you could use that instead of nanohttpd. Just create an instance of io.milton.simpleton.SimpletonServer and call its start() method
You can follow the Simpleton implementation code as a guide to integrating with nanohttpd if you want to use that:
https://github.com/miltonio/milton2/tree/master/milton-server-ce/src/main/java/io/milton/simpleton
This shows a fairly typical integration, from io.milton.grizzly.GrizzlyServer. Pretty simple really.
@Override
public void service(Request request, Response response) throws Exception {
GrizzlyMiltonRequest req = new GrizzlyMiltonRequest(request);
GrizzlyMiltonResponse resp = new GrizzlyMiltonResponse(response);
httpManager.process(req, resp);
}
Upvotes: 2