Rest Annotation and Encoder

This allows rest-style urls for the page service. Support for the other tapestry sevices is forthcoming.

The UriTemplate annotation allows you to specify the request path that will trigger any given class and (at the same time) guides the page encoder to generate this url. Here's a typical example:

                @UriTemplate("/my/customers")
                public abstract class ShowCustomers() {
                    // ...
                }
            

In order to enable this, you'll need to add the following definitions and contributions in your application hivemodule.xml (If you're already using an encoder for the page service, you'll also need to remove it) and add an entry in web.xml so that the Tapestry servlets handles '/view'

    <service-point id="restPageEncoder" interface="net.sf.tacos.rest.RestPageEncoder">
        <invoke-factory>
            <construct class="net.sf.tacos.rest.RestPageEncoder">
                <set property="url" value="/view"/>
            </construct>
        </invoke-factory>
    </service-point>

    <contribution configuration-id="tapestry.init.ApplicationInitializers">
        <command after="tapestry.globals.SetupServletApplicationGlobals" id="initRestPageEncoder"
                 object="service:restPageEncoder"/>
    </contribution>

    <contribution configuration-id="tapestry.url.ServiceEncoders">
        <encoder id="rest-page-encoder" object="service:restPageEncoder"/>
    </contribution>