FreeMarker Variables Provided by iServer |
FreeMarker is a "template engine"; a generic tool to generate text output (anything from HTML to autogenerated source code) based on templates. SuperMap iServer uses FreeMarker templates files (*.ftl) to generate the HTML representation of resources. When developing based on Restlet, we agree on that the *.ftl file name has the same name with the resource configuration item ID, and is placed in WEB-INF\lib\*.jar\templates or WEB-INF\classes\templates. When developing based on JAX-RS, there is no restriction on the *.ftl file name. However, the *.ftl file should also be placed in WEB-INF\lib\*.jar\templates or WEB-INF\classes\templates. Meanwhile, when using the *.ftl file, we need to specify with the @Template annotation.
SuperMap iServer provides some variables for *.ftl template making, through which resource information can be retrieved.
FreeMarker Variables Provided by SuperMap iServer
Name | Description |
${resource.rootPath} |
The root path of the resource that begins wtih "http ://". |
${resource.url} |
The URI of the resource that begins with "http ://", with no suffix. |
${resource.method} |
The HTTP mehtod of the current request. |
${resource.supportedPostfixs} |
The suffix corresponding to the output formats supported by the resource. |
${resource.supportedOperations} |
The HTTP methods supported by the resource. |
${resource.customVariables} |
The custom parameters. |
${resource.content.*.*} |
The content of the response. For the image resource, esource.content.imageUrl indicates the image URL and resource.content. mapParam. center.x indicates the x coordinate of the image. |