Template Functions / Other Functions |
The resourceURI() function builds the URI to images or resources.
<?xml version="1.0"?> <APPLICATION Parent="defaultgwc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.4js.com/ns/gas/2.21/cfextwa.xsd"> <OUTPUT> <MAP Id="DUA_HTML5"> <PICTURE> <PATH Id="Resources" Type="WEBSERVER">/pic</PATH> <PATH Id="Image" Type="APPSERVER" ExtensionFilter=".png;.gif"> $(res.path.pic);$(application.path)</PATH> <PATH Id="SetHtml5" Type="APPSERVER" ExtensionFilter=".png;.js;.css" DVMFallbackAllowed="FALSE">$(res.path.tpl.html5);$(res.path.tpl.common) </PATH> </PICTURE> </MAP> </OUTPUT> </APPLICATION>
If value is an absolute URL (such as http://www.mycompany.com/favicon.ico), regardless of the pictureId is used, the value is directly returned.
resourceUri("http://www.mycompany.com/favicon.ico", "whatever") = http://www.mycompany.com/favicon.ico
resourceUri("myImage.png", "Resources") = /pic/myImage.png
resourceUri("myImage.png", "Image") = /wa/i/card/Image/DUA_AJAX/myImage.pngThe generated URL is composed by a prefix (wa/i), an application ID (appName or groupName/appName), an output map ID (DUA_AJAX), and the resource name (value). This means that all application sessions share the same resources, as it is the case with GDC images.
If the resource value do not have extension, extension completion will be made according to FGL standards.
If the resource is not found locally, and if the DVMFallbackAllowed attribute is not set to FALSE, the resource is retrieved by the DVM. In this case, a file transfer URL is built that uniquely identifies the resource.
resourceUri("myImage.png", "Image") = /wa/ft/<sessionID>/<fileTransferID>