User Tools

Site Tools


webremote:resourceserver

This is an old revision of the document!


Web Remote Resource Server:

Added in XTension 9.5.3 you can now serve up small images or other items that might be useful when making displays via the various controls that can insert HTML into a page. The Unit Description As HTML control inserts the Description of the Unit into an iFrame, and the Unit Property As HTML control inserts your html inline. If you have images to display, possibly for something like a custom weather state icon or something similar, you can now use the built in resource server to serve that up to the browsers.

This is currently only available for the full sized Web Remote and has not been added to the Mobile web Remote. Please let me know if that is a thing that you need.

Resources should be kept reasonable in size as they have to be fully loaded into memory before being served. Sending multi megabyte movies or similar may cause a problem or run very slow. Resource files are not cached in memory in the server, but are read from disk when asked for so serving large files or from slow disk drives will not be as fast as using a truly optimized static page web server such as apache. It does have the advantage of being self contained and being served on the same port so that you do not need to pass through or forward several different ports to the Mac or any of those complexities. Not to mention managing an apache server.

An ETag system is used for cache control in the browser. A browser will not reload a file that has not changed. If you, or a program updates a file in a way that changes the modification date this will also change the ETag. The next request from the browser will load and cache locally the new version of the file.


Resource Folder:

The resource folder will be created inside your Database upon the first launch of a Web Remote instance after the update to 9.5.3. To find the active database in the Finder most easily use the Database menu in XTension and select “Reveal Database In Finder” Because the database is a bundle in order to open it and find the internal folders you will need to control or right click on it in the Finder and select “Show Package Contents”

Once inside the Database you’ll find a folder named “Web Remote Resources” Any file you place into this will be available to be served from the built in Web Remote instance.

All Instances of the Web Remote running on the machine will share the same Resources folder.


Linking To Files:

The path to use when linking to a file in the root of the Web Remote Resources folder will start with /special/resources/ so a link to your file might look something like /special/resources/your_file_name.jpg

You can add more folders inside the Web Remote Resources folder as needed.

Links including the “..” convention to back up a folder will return an error in order to protect you from someone serving themselves up other files on your computer.

All of the most commonly used Mime Types are supported and guessed at via the file extension. If you find that you need to serve up an unusual file type that does not work properly please let me know what the file extension is and what the mime-type should be and I can add it to the supported types list.

There is currently no way to force a download of the file rather than just have the browser load it. This could be done fairly easily. If this is a thing that you need please let me know and I can add that to the features list.

webremote/resourceserver.1683645023.txt.gz · Last modified: 2023/05/09 15:10 by James Sentman