public class MessagesDependencyDirective extends JavaScriptDependencyDirective
This directive is used to address the problem of browsers caching stale i18n messages for the application. It modifies the WebScript URL requested to include an checksum generated from the WebScript results to ensure that when those results change that the browser will be forced to request the updated version (because the browser cached version will be stored against a different URL).
AbstractDependencyExtensibilityDirective.ProcessedDependency| Modifier and Type | Field and Description |
|---|---|
static String |
LOCALE_REQ_PARM |
FORCE_AGGREGATED_OUTPUT_PARAMdependencyAggregator, dependencyHandler| Constructor and Description |
|---|
MessagesDependencyDirective(String directiveName,
org.springframework.extensions.surf.extensibility.ExtensibilityModel model) |
| Modifier and Type | Method and Description |
|---|---|
void |
execute(freemarker.core.Environment env,
Map params,
freemarker.template.TemplateModel[] loopVars,
freemarker.template.TemplateDirectiveBody body)
Processes a request to generate i18n messages.
|
protected String |
getResourceControllerMapping()
Overrides the default value which is mapped to the
ResourceController and instead
returns the value which is mapped to WebScript processing. |
void |
setMessagesWebScript(MessagesWebScript messagesWebScript)
Sets the
MessagesWebScript. |
addLegacyDependencyRequest, createDependencyDirectiveData, createExtensibilityDirectiveData, getDependencySource, getTargetElementgetModelObject, getRequestContext, getToInsert, getUpdatedSrc, getWebFrameworkConfig, processDependency, setDependencyAggregator, setDependencyHandler, setModelObject, setRequestContext, setWebFrameworkConfigafter, before, getId, getModel, merge, remove, replacepublic static final String LOCALE_REQ_PARM
public MessagesDependencyDirective(String directiveName, org.springframework.extensions.surf.extensibility.ExtensibilityModel model)
public void setMessagesWebScript(MessagesWebScript messagesWebScript)
Sets the MessagesWebScript.
messagesWebScript - MessagesWebScriptprotected String getResourceControllerMapping()
Overrides the default value which is mapped to the ResourceController and instead
returns the value which is mapped to WebScript processing.
getResourceControllerMapping in class AbstractDependencyExtensibilityDirectivepublic void execute(freemarker.core.Environment env,
Map params,
freemarker.template.TemplateModel[] loopVars,
freemarker.template.TemplateDirectiveBody body)
throws freemarker.template.TemplateException,
IOException
Processes a request to generate i18n messages. This is specifically designed to work with the
WebScript backed by MessagesWebScript. It will output a request to import a JavaScript
via the WebScript but will include a checksum as part of the filename to ensure that the browser
does not use stale cached data.
execute in interface freemarker.template.TemplateDirectiveModelexecute in class JavaScriptDependencyDirectivefreemarker.template.TemplateExceptionIOExceptionCopyright © 2005–2016 Alfresco Software. All rights reserved.