I am starting a new topic for discussions related to the CalDav and CardDav implementation in Moqui. The repo can be found here: GitHub - grozadanut/dav-server: Moqui component that adds WebDAV support, mainly for CalDav and CardDav.
I have some implementation related questions that I need help with. First, to add some context, CalDav and WebDav in general is an extension to HTTP, so in order to implement it we have some requirements that we need to satisfy, specifically:
- Support for non standard HTTP methods: PROPPATCH, PROPFIND, ACL, REPORT…
- Read HTTP request headers(eg: Depth) and write response headers(eg: DAV)
- Return an XML body response.
Initially I was considering to use the REST services functionality in Moqui(rest.xml definitions), but I have some problems in satisfying the requirements above:
- I think this can be done by extending
<xs:element name="method">
inrest-api-3.xsd
file with the new methods. - For reading headers I think you can get them from the execution context WebFacade, but for returning specific headers, this is not supported as I can see in
RestApi
line 250:return new RestResult(result, null)
the result is created with null headers. - As far as I understand the code I think only JSON response is supported. Not sure how to add XML support here.
There is also another requirement in the WebDAV ACL specification which states that for failed authentication we need to return not only an error status code, but also return a specific XML inside the response body that explains the error. Authentication is also handled by the Moqui framework, so not sure how to return a specific body on failed authentication.
So my question is: would it be feasible to extend the Moqui framework REST functionality, or is there another way in Moqui to create easy routings between a URL(with url placeholders like /calendar/{id}
and method type like GET, PUT, REPORT, ACL...
) and a service in which you can return XML and custom headers?