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

Reply via email to