Serving static content from Xojo Web

Now available on GitHub is open sourced code to help you serve static files from your Xojo Web application. This is especially useful if you are running standalone or load balanced apps and do not want to depend on another web server.

Check it out here: https://github.com/1701software/XojoWeb_StaticContent

For example at ServerWarp we host many load balanced applications for customers. Many will produce PDF reports for users. In order to serve those PDF reports they have often relied on writing those PDF files to another directory of another domain or subdomain because Xojo Web could not natively serve those files. Technically the "WebFile" class works for this purpose but the user and development experience is a bit subpar especially for mobile clients. You can only access files that way if you have an active Xojo Web session. What if you want to email your user a link to the download?

The problem at ServerWarp is we isolate your apps and domain web servers from each other to protect from vulnerabilities and provide the most secure environment. So it requires extra configuration to get your Xojo standalone app to be able to write to a specific folder of another domain. The other obvious downside is you now need a secondary web server and domain/sub-domain to serve these files. It would be great if you could simply write your static files to a sub-folder inside of your app directory and serve those files directly. That is exactly what we deliver here.

The code we are presenting on GitHub today allows you to easily map folders to the Xojo Web application to be served as static content. It is a drop in module that extends the 'App' object of your Xojo Web project making integrating it super simple.

The example project demonstrates two distinct static folders with a PDF, image, and text file. It demonstrates how to map the folders and the Xojo Web app presents links to test the functionality very quickly. To give you an idea of how it is to integrate check out this screenshot of the 'App.HandleURL' event handler: