⬆️ ⬇️

Fantasy on WebDAV

Do not shoot the pianist. He plays as best he can.
The WebDAV protocol, as I understand it, is an extension of HTTP methods for working with collections of objects, their properties and versions. A typical example of collections are file systems, and in relation to WEB, cloud file storage. Interaction with some of them is possible with the help of WebDAV client applications of any modern OS.



I suggest to look at the collections from a slightly different side: to consider them not only as a container, but also as a filter, i.e. some fixed action to convert objects to a specific type. For files, these can be OCR folders, folders for converting documents from one type to another (doc, xlsx, pdf, odt, html, ...), archiving folders (zip, tar, rar), etc. . The file placed on the fly (PUT method) in these folder-filters is converted to the corresponding view.



Conversion chains are implemented by copying (MOVE, COPY methods) from one remote folder to another. The sequence "rotate image - recognize" (omitting the mount davfs) on the client side may look like this:

')

cp ~/images/document.jpg /dav/convert/images/rotate90/ mv /dav/convert/images/rotate90/document.jpg /dav/convert/images/ocr(rus)/document.doc mv /dav/convert/images/ocr(rus)/document.* ~/texts/ 


In the proposed example, the type and parameters of the conversion is determined by the folder name, and the format of the result is the extension of the destination file. It is logical to perform a “thin” transformation parameterization by changing the properties of the collection (virtual user folder) or more traditional way — by passing the parameter file in one package with the original one.



Packing may be required in cases where a set of files is needed without which the action initiated upon completion of copying will lead to an erroneous result. The purpose of file batching can serve as a virtual temporary storage folder. The sequence of actions for checking the package of XML files, the result of which is a protocol file, may look like this:



 cp ~/document1.xml /dav/storage/ cp ~/document2.xml /dav/storage/ ... cp ~/documentN.xml /dav/storage/ cp /dav/storage/ /dav/check/checkxml/ mv /dav/check/checkxml/storage/protocol.html ~/result/ 


Since for conversions, sharing is unnecessary, versioning support and long-term storage (on the contrary, access should be limited to the user's monopoly session, and unclaimed files deleted after the session timeout), there will be a limited set of WebDAV class 1 methods to implement the interface.



This strange idea came to me while thinking about the user interface to the RESTful server of console applications . The described approach is more flexible, and the implementation is no more complicated than the traditional WEB-solution for browsers.



Sandbox, June 2015.

Source: https://habr.com/ru/post/268107/



All Articles