Loom requires a filter to handle action requests:
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:loom="http://loom.extrema-sistemas.org/schema/loom"
xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd
http://loom.extrema-sistemas.org/schema/loom http://loom.extrema-sistemas.org/schema/loom.xsd
"
metadata-complete="true"
version="2.5">
<display-name>Loom Demo App</display-name>
<filter>
<filter-name>LoomFilter</filter-name>
<filter-class>org.loom.filter.LoomFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>LoomFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
</web-app>
The simplest way to create a working configuration file is using the scaffolding tool.
<loom:config development="true">
<loom:action-scan base-package="com.acme.action,org.loom.action.support"/>
<loom:messages defaultLocale="en" />
<!--
The browser resource bundles (CSS or javascript)
-->
<loom:web-resources>
<loom:web-resource name="css">
/css/yui/reset.css
/css/yui/base.css
/css/styles.css
</loom:web-resource>
<loom:web-resource name="myapp">
classpath:js/prototype/prototype.js
classpath:js/loom/core/core.js
classpath:js/loom/core/format.js
classpath:js/loom/ui/ui.js
/js/myfile.js
</loom:web-resource>
</loom:web-resources>
</loom:config>
<!--
Register interceptors and annotation-processors
-->
<context:component-scan base-package="org.loom.persistence,org.loom.interceptor,org.loom.annotation" />
<!--
Reload resources on-the-fly
-->
<bean class="org.loom.config.ResourcesWatchdog" />
This example will search for actions inside com.acme.action and org.loom.action.support. Any class inside these packages that is not abstract and implements the Action interface will be registered automatically.
The example also includes a web resource bundle configured to serve some css and js files.
The ResourcesWatchdog instance configured here will observe modification of files: any modification to messages.properties or any css/js file will be detected at runtime without restarting the server.
When config.development is set to false all javascript and css files will be concatenated and minified before being delivered to the browser.