3. Using Virgo Snaps in your application

Every snap or host should also be a regular WAB (Web Application Bundle), all you have to do is add some additional configuration to benefit from VS.

3.1 Configuring the Host

In the WAB that is to act as a host to Snaps bundles, all that needs to be added is a filter in the hosts ' web.xml'. This filter can be mapped to any sub path that you want forwarded to registered snaps. It is important to note the extra dispatcher declarations in the filter-mapping. Without these internal lookups, resources like JSPs won't get passed to the appropriate snap when needed.

<filter>
    <filter-name>host-filter-name</filter-name>
    <filter-class>org.eclipse.virgo.snaps.core.SnapHostFilter</filter-class>
</filter>

<filter-mapping>
    <filter-name>host-filter-name</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>INCLUDE</dispatcher>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>REQUEST</dispatcher>
</filter-mapping>