Resource dependencies declared by modules are static. For example,
@ResourceDependencies({
// META-INF/resources/cmobilecom/module/hr/employee.js
@ResourceDependency(library="cmobilecom",
name="module/hr/employee.js")
})
public class WebHRModule extends HRModule implements WebModule {
...
}
If a module is included in an instance type, all pages of the instance type will have
the module static resources added into page.
UI component example:
@ResourceDependencies({ // META-INF/resources/cmobilecom/mycomponent.js @ResourceDependency(library="cmobilecom", name="mycomponent.js") }) public class MyComponent extends UIInput { ... }BeanViewEncoder resources are dynamic. For example,
public class MyBeanViewEncoder extends EntityBeanViewEncoder<MyType> {
// define dynamic web resources
@Override
protected List<WebResource> getWidgetResources(String widgetType) {
if ("EmployeeBean".equals(widgetType)) {
// module name: lowercase in file path and URL
// META-INF/resources/cmobilecom/module/hr/employee.js
WebResource resource = new WebResource("hr",
"employee.js", "cmobilecom", false, true);
return Arrays.asList(resource);
}
return super.getWidgetResources(widgetType);
}
}
See Bean View Encoder for detail.