Currently Control resource deployment is a two step process:
#1 override onDeploy and copy the resources to the web folder
#2 register each Control that must deploy resources in click.xml
A disadvantage of this approach is that Controls must be instantiated to call their onDeploy method. This means that Context cannot be used in a Control constructor, without explicit checking for Context availability.
One of the side effects of module support (
CLK-347) is that another option became available for deploying resources. This option is based upon convention. When creating a jar containing Click resources simply make the resources available under the folder 'META-INF/web' and Click will automatically copy all the resources to the application web folder. Click will keep the directory structure as defined under 'META-INF/web' when copying resources.
This makes the deployment a bit easier as everything is done in one step.
Using this approach there is also no need to instantiate Controls to invoke the deploy method. Thus Context can safely be used in a Control constructor.