You could use the Restlet API or any other JAX-RS implementation that can run as a servlet.
To have the web service co-exist nicely with Tapestry, there is one thing you have to configure in your Tapestry application module:
/**
* Keep Tapestry from processing requests to the web service path.
*
* @param configuration {@link Configuration}
*/
public static void contributeIgnoredPathsFilter(
final Configuration<String> configuration) {
configuration.add("/ws/.*");
}
This snippet tells the Tapestry filter not to handle requests to the /ws/ path where the web service is located.
Here's a snippet showing what your web.xml should approximately look like with Tapestry plus a Restlet Servlet:
<filter>
<filter-name>app</filter-name>
<filter-class>org.apache.tapestry5.spring.TapestrySpringFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>app</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- Restlet adapter -->
<servlet>
<servlet-name>WebService</servlet-name>
<servlet-class>
com.noelios.restlet.ext.spring.SpringServerServlet
</servlet-class>
...
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>WebService</servlet-name>
<!-- This path must also be set in AppModule#contributeIgnoredPathsFilter,
otherwise Tapestry, being a request filter, will try to handle
requests to this path. -->
<url-pattern>/ws/*</url-pattern>
</servlet-mapping>
That should help you get started.