Managing Files in a Server Farm Cluster
There are three types of resources in a uniGUI application:
Static resources
Dynamic resources in application global folder
Dynamic resources in session local folder
Static resources
These are files that are statically available on your server. Examples: Ext JS library, various other JavaScript files, themes, 3rd party JS & CSS files and files placed under the /files folder of your application.
Majority of these files will be installed on your server by installing uniGUI Runtime and uniGUI Theme Pack. Primarily, you should install these resources on the PC where the master HyperServer runs. Installing uniGUI Runtime and uniGUI Theme Pack on ServerNodes is optional. The only case when you need to install these resources on each ServerNode is when you want to locally test your web application individually on each ServerNode.
Static files that you want to share under /files should be kept in your master HyperServer /files folder. The /files folders of ServerNodes are not accessible from an external URL, so when a web session tries to access a file at the URL http:/domain/files/common.pdf, uniGUI HyperServer will look into master's /files folder to find the file named common.pdf.
Do not use the /files folder to create dynamic content, as ServerNodes' /files folders are not accessible from an external URL. In general, global folders such as /files should never be used to create dynamic files. Doing so can cause concurrency problems unless you use a lock mechanism to protect the dynamically created content. The correct place to create and save dynamic content for a session is the session's local folder.
Dynamic resources in application global cache folder
The global cache folder is the place where commonly used resources are dynamically created. This is done automatically by uniGUI. Normally, you should not need to create any files in the global cache folder. uniGUI uses special locking mechanisms to avoid problems that may arise from concurrent access to the same resource while it is being created. The master HyperServer is able to locate and relay those resources to the requesting client even if they reside on a remote ServerNode.
Use these methods to access global cache information:
UniServerModule.GlobalCachePath— get global cache folder for your application.UniServerModule.GlobalCacheURL— get global cache URL.
Dynamic resources in session local cache folder
The local cache folder is used by uniGUI to create and maintain resources which are not shared among sessions. Resources placed in the local cache folder are private and can only be accessed from that session. Local cache is the right place to create temporary files that belong to the current session. The master HyperServer is able to locate and relay those local cache resources to the requesting clients even if they reside on remote ServerNodes.
Use these methods to access local cache information:
UniServerModule.LocalCachePath— get local cache folder for the current session.UniServerModule.LocalCacheURL— get local cache URL.UniServerModule.NewCacheFileUrl— get a unique local cache file name which you can use to store various files.
Function signature:
Example — get a local cache file name to create a PDF file:
The returned var parameter AUrl can be used to redirect a browser tab or a browser frame to show the PDF file.
For more details on how to create local cache files, review the FastReport or Report Builder demos.