We can create the DAV object and insert it into the Virtual File System (VFS) as soon as we have a lock directory. You can also create your own custom IO interface that for example uses a database for storing files â in other words, you can have a WebDAV server that stores all resources in a database. See Mako Specific features for more information on the IO interfaces provided. The Mako server provides a number of IO interfaces. For example, a TEMP directory such as c:\TEMP is translated by dos2unix to the path /c/TEMP/. The IO interface requires UNIX style paths on all operating systems.
The dos2unix function makes sure the code also works when run on Windows. LOCK sub directory in the TEMP directory. It then uses the root IO when creating the. The above code tries to find the host systems TEMP directory from the systemâs environment variables.
Ldir=nil - WebDAV may be in read only mode when used by some clientsĮxample 1: Shows how to create the WebDAV lock directory. Trace("Cannot open WebDAV lock directory:",ldir)
Local ldir = mako.dos2unix(env and (env.TMP or env.TEMP) or "/tmp")."/.LOCK" The following example shows how to create a lock directory using the Mako Server's root directory object: local rio = ba.openio"disk" - The root IO You can use the DAV object without a lock directory, but some WebDAV clients will be in "read only" mode when connecting to a DAV object that does not support file locking. Here are the links to the online documentation:ĭAV locking is a part of the WebDAV standard and we need to provide a directory for the DAV object for file lock operations. You can find the two file server objects in the documentation.
WebDAV and Web-File-Server Virtual File System Nodes You can also read the VFS introduction in our online documentation. The Lua Tutorials includes a number of examples that teaches you the VFS fundamentals. This would be inconvenient since the user would have to visit the LSP before the user could access the WebDAV resource. The user would then first have to visit the LSP before the WebDAV object would be accessible. It is also possible to dynamically insert say a WebDAV object into the VFS from a Lua Server Page (LSP). Your application's ".preload" script is run at startup and this script can create VFS nodes and populate the Mako Server's VFS. It is common to create VFS nodes such as the WebDAV object at system startup in a ".preload" script. You can also define your own objects and insert these objects into the VFS. The Mako Server provides a number of pre-defined objects that can be created and installed into the VFS such as the WebDAV object. The VFS is responsible for mapping URLs to resources such as your application's LSP pages. The Virtual File System (VFS) makes it possible for you to programmatically build application server resources in a running system. You should use the DAV object if your objective is to create a very fast WebDAV server since the DAV object uses a pure "C" implementation and not a hybrid solution. The only drawback with the WFS is that it triggers the execution of Lua code, thus slightly slowing down the operation when using WebDAV. The benefit in using the WFS object is that it can be used by browsers and WebDAV clients. The WFS uses some internal magic to provide a Web File Manager and WebDAV server on the same URL.
The video above shows how to connect a Windows and Mac computer to a WebDAV server. However, if you just want a quick way to enable the WebDAV server on a private network without authentication, simply create the following nf configuration file:Įnabling the combined WebDAV Server and Web File Manager using nf. In this tutorial we will show how to programmatically create a Web File Server (WFS) object. The combined WebDAV Server and Web File Manager is called the Web File Server. You can either access it through a Web browser or mount it as a WebDAV drive, in which case it works like a local drive. The Web File Server object transforms your Mako Server into a powerful and secure storage system, letting you access and share files from any connected computer or device in the world.