tapestry-resteasy is just bringing RESTEasy to Tapestry. There's no dependency to JPA/Hibernate. Do you mean the PersistenceService in the example on the page under "Code your singleton resource"? That's not a necessity, just an example for a Rest resource. In your case, you would use Agrest instead.
You don't need to edit web.xml because tapestry-resteasy uses a Tapestry HttpServletRequestFilter to piggyback Tapstry itself, instead of going through the a custom servlet defined in the web.xml. Everything that would be done in the web.xml is done with code instead. This way, you don't need an extra Bridge to handle service injection. https://github.com/tynamo/tapestry-resteasy/blob/master/src/main/java/org/tynamo/resteasy/ResteasyRequestFilter.java The next steps for simple proof-of-concept would be something like this: - add tapestry-resteasy to your project - write a service to setup the AgRuntime - write a simple resource with a single @GET method using Agrest - contribute the AgRuntime and resource like in my previous mail. - test it with your browser or curl Hope this helps! On Tue, Aug 3, 2021 at 1:12 PM D Tim Cummings <t...@triptera.com.au.invalid> wrote: > Thanks for this very detailed reply. I will work through what you have > suggested and see how I go. > > I had a look at tapestry-resteasy but it seems to rely on hibernate or > jpa and I am using cayenne. I am not sure what is required for > org.tynamo.services.PersistenceService. Also tapestry-resteasy says I > don't need to edit web.xml. > > Another example I am following says I do need to edit web.xml. > https://github.com/andrus/wowodc13 is an example for tapestry and > cayenne and jersey 1.x rest. It seems to rely on a JerseyTapestryBridge > [1] but the code looks specific to jersey 1.x and wouldn't work with > jersey 2.x > > Cheers > > Tim > > [1] > > https://github.com/andrus/wowodc13/blob/master/site/src/main/java/demo/rest/jersey/JerseyTapestryBridge.java > > On 3/8/21 17:15, Ben Weidig wrote: > > Hi Tim, > > > > full disclosure: I haven't used Cayenne or Agrest, but I checked out > their > > documentation. > > > > I don't think there's anything Tapestry-specific needed to get it up and > > running except setting up Rest. > > They say in their docs that you still have to write your JAX-RS endpoints > > and do security yourself. > > > > For JAX-RS, there's tapestry-resteasy > > https://www.tynamo.org/tapestry-resteasy+guide/ > > There are examples how to add Rest to Tapestry and register your > resources. > > > > The AgRuntime should be contributable just like a Rest resource. RestEasy > > treats many of its classes are contributable (Resources, Provider, etc.). > > You could create a service to build it. > > > > @Contribute(javax.ws.rs.core.Application.class) > > public static void configureRestProviders(Configuration<Object> > singletons, > > YourAgRuntimeBuilder builder) { > > singletons.add(builder.build()); > > singletons.addInstance(YourCredentialsInterceptor.class); > > singletons.addInstance(YourResource.class); > > } > > > > For security, we use custom headers containing an API key/secret that are > > validated by a javax.ws.rs.container.ContainerRequestFilter with > > @Priority(Priorities.AUTHENTICATION) and > > @Priority(Priorities.AUTHORIZATION) and plug in your security code. > > > > But as said before, I haven't tested it, and it just looks this way to me > > at first glance. > > > > Cheers, > > Ben > > > > On Tue, Aug 3, 2021 at 5:28 AM D Tim Cummings > <t...@triptera.com.au.invalid> > > wrote: > > > >> Does anyone have experience integrating Agrest (https://agrest.io/) > into > >> a Tapestry app? My Tapestry app uses Cayenne ORM and it looks like > >> Agrest works well with Cayenne to produce REST functionality. It would > >> be helpful to see some sample code. > >> > >> Thanks in advance > >> > >> Tim > >> > >> > >> > >> > >