Client static content in the file system
Glossary Item Box
Introduction
Before the version 7.11, at the request of client content (.js, .css files), the application server generated the content dynamically, based on the current structure of package connections and schema dependencies. Generated data were cached and sent to client application.
Starting with version 7.11 all client content is preliminary generated in special application folder i. e. it becomes static. When requesting client content, the IIS searches for requested content in this folder and sends it to the client application. Thus, the overall performance of the application is increased and the server load is reduced.
Advantages and disadvantages
Advantages and disadvantages of using the client static content are given in the Table 1.
Table 1. Advantages and disadvantages of using the client static content
Advantages | Disadvantages |
---|---|
Dynamic generation of client content |
|
No need to pre-generate client content | Processor overload when computing the hierarchy of packages, schemas, and content generation |
Database overload when for getting the hierarchy of packages, schemas, and content generation | |
Memory consumption for caching client content | |
Usage of preliminary generated client content |
|
Minimum CPU load (CPU) | Need to pre-generate client content |
Missing database queries | |
Client content is cached by IIS |
Generating static client content
Client content is generated in the specific folder (.\Terrasoft.WebApp\conf). In contains .js files with schema source code, .css files of styles and .js files of resources of all cultures of the application.
ATTENTION
Starting with version 7.11.1 the .\Terrasoft.WebApp\conf folder also contains images.
ATTENTION
The application's IIS pool user requires modify permission (reading and writing of files and subfolders and deletion of the folder) to the .\Terrasoft.WebApp\conf directory. Without the write permission bpm'online application will not be able to generate static content.
The IIS pool user name is set in the [Identity] property. You can access this property through the [Advanced Settings] menu command on the [Application Pools] tab of the IIS Manager.
The actions to start generation of client content
Primary or secondary generation of static client content starts when the following actions are performed:
- Saving a schema through client schema designer and client objects designer.
- Saving through section wizard and detail wizard.
- Installing and deleting applications from Marketplace and zip archive.
- Applying translation.
- The [Compile all items] and [Compile modified items] actions in the [Configuration] section.
ATTENTION
When deleting schemas and packages from the [Configuration] section you need to perform [Compile all items] and [Compile modified items] actions.
When installing and updating schemas and packages from the SVN you need to perform [Compile all items] action.
NOTE
Only the [Compile all items] action performs full regeneration of client static content. Other actions lead only to regeneration of modified schemas.
Generation of client content with the WorkspaceConsole utility
The BuildConfiguration operation was added to the WorkspaceConsole utility and this operation performs generation of client content. Operation parameters are listed in table 2.
Table 2. Parameters of the BuildConfiguration operation
Parameter | Details |
---|---|
workspaceName | Workspace name by default (Default). |
destinationPath | Folder to which the static content will be generated |
webApplicationPath |
Path to the web applcation from which the information about connection to database will be read. This parameter is optional. If this value has not been indicated, the connection will be established to the database specified in the connection string of the Terrasoft.Tools.WorkspaceConsole.config file. If the value is specified, the connection will be established with the database from the ConnectionStrings.config file of the web application. |
force |
If the value is set to true, the generation of the content will be performed for all schemas. If the value is set to false, the generation will be performed only for modified schemas. This parameter is optional. The value is false by default. |
Use cases:
Terrasoft.Tools.WorkspaceConsole.exe -operation=BuildConfiguration -workspaceName=Default -destinationPath="C:\WebApplication\BPMOnline\Terrasoft.WebApp" -force=true -logPath=C:\wc\log
Terrasoft.Tools.WorkspaceConsole.exe -operation=BuildConfiguration -workspaceName=Default -webApplicationPath="C:\WebApplication\BPMOnline" -destinationPath="C:\WebApplication\BPMOnline\Terrasoft.WebApp" -force=true -logPath=C:\wc\log
Compatibility with the development in the file system mode
Currently, the development in the file system is no compatible with getting client content from preliminary generated files. For the correct work of the development in the file system you need to disable getting static client content from the file system. Set the “false” for the UseStaticFileContent flag in the Web.config file to disable this functions.
<fileDesignMode enabled="true" /> ... <add key="UseStaticFileContent" value="false" />
Generation of client content when adding a new culture
Execute the [Compile all items] action in the [Configuration] section after adding new cultures.
ATTENTION
If a user cannot log in to the system after adding new culture, you need to access the [Configuration] section by the http://[path to application]/0/dev path and execute the [Compile all items] action.
Changes in the parameter object that generates an image URL (version 7.11.1)
Images in the client part of bpm’online are always being requested by a browser with a specific URL specified in the src attribute of the img html-element. The Terrasoft.ImageUrlBuilder (imagurlbuilder.js) module with the getUrl(config) public method that gets the image URL is used in the URL generation. This method receives the config configuration JavaScript object that contains an object of parameters in the params property. The image URL is being generated on the basis of this object.
Till the 7.11.0 version the structure of the params object had the following view:
config: { params: { schemaName: "", resourceItemName: "", hash: "" } }
In this code:
- schemaName – schema name (string)
- resourceItemName – image name in the bpm’online (string)
- Hash – image hash (string).
Starting with version 7.11.1 the resourceItemExtension string property that contains file extension (for example, .png) was added to the parameters list. A new structure of the params object:
config: { params: { schemaName: "", resourceItemName: "", hash: "", resourceItemExtension: "" } }
ATTENTION
Starting with version 7.11.1 if the params object is generated in the custom program code (not obtained from the resources), the resourceItemExtension property should be added to the object. In the opposite case, the image will be retrieved from the database, not from the static content. In the next versions, the ability to retrieve an image from the database will be disabled. Therefore, the absence of the resourceItemExtension property will cause errors when loading images on a page.
An example of correct generation of configuration object of parameters for getting the URL of a static image:
var localizableImages = { AddButtonImage: { source: 3, params: { schemaName: "ActivityMiniPage", resourceItemName: "AddButtonImage", hash: "c15d635407f524f3bbe4f1810b82d315", resourceItemExtension: ".png" } } }