Using the Custom Controller

This description is based on the assumption that:

  • You have written the class com.escenic.framework.controller.impl.CustomController, which extends the class com.escenic.framework.controller.AbstractController.

  • This class is in a separate Maven module and packaged in a jar file.

  • You want to use this class as the controller for one of the standard widgets.

To make use of the class you have written:

  1. Make sure that the Maven module for the custom controller contains a .properties file called CustomController.properties in the folder /src/main/resources/com/escenic/servlet/default-config/com/escenic/framework/controller/impl. The file must have the following contents:

    $class=com.escenic.framework.controller.impl.CustomController
  2. Run:

    mvn clean install

    in the Maven module folder. This will generate a .jar file and install it in your local repository.

  3. Download and extract the Widget Framework Core distribution.

  4. Choose one of the core widgets for modification - the code widget for example.

  5. Create a .properties file called ControllerFactory.properties in the widget-core-code/src/main/resources/com/escenic/servlet/default-config/com/escenic/framework/controller/factory folder.

  6. Open ControllerFactory.properties for editing and enter the following:

    controller.code=/com/escenic/framework/controller/impl/CustomController
  7. Change directory to the distribution's misc/widgets folder.

  8. Run the following command.

    mvn clean install
  9. Change directory to the distribution's misc/demo folder.

  10. Open pom.xml for editing.

  11. Add a dependency to the .jar file containing the custom controller and relevant configuration files. The dependency must be added in compile scope to ensure that the .jar file containing the custom controller is present in WEB-INF/lib folder of demo.war after the build.

  12. Run:

    mvn clean install

    During the build, all the ControllerFactory.properties files in various modules will be merged. The merged file will contain the line that you added to the ControllerFactory.properties file for the code widget.

  13. Deploy the demo.war webapp created in misc/demo/target.