Download

Get Loom

Configuration

web.xml

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"
    xsi:schemaLocation="
		http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.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>

Spring

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" />


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 webResourceBundleRepository configured to serve some css and js files.

Development vs. Production

The Config.development attribute controls the behavior of:

  • Modification of files: when development is set to true, any modification to messages.properties or any css/js file will be detected at runtime without restarting the server.
  • Javascript and CSS concatenation and minification: when set to false all javascript and css files will be concatenated and minified before being delivered to the browser.