users@jersey.java.net

Re: [Jersey] Re:[Jersey] How to customize OPTIONS Response

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 13 Nov 2008 17:43:17 +0100

On Nov 13, 2008, at 4:53 PM, Babu Naidu wrote:

> Hi Paul,
>
> Thanks for replying.
>
> Yes, I am looking for pruning OPTIONS response based on the
> authenticated user roles in a generic way, rather than creating
> OPTIONS method on every resource.
>
> I did browse jersey code, most of the classes are marked final, so I
> can't extend. I'll take a look if I can refactor WADL code to
> introduce/plugin configurable authorization delegators.
>
> Please let me know if you've any ideas.
>

Off the top of my head:

1) There needs to be a way to identify the roles associated with
resource methods, perhaps an annotation
      on the method, reusing say @RolesAllowed.

2) The WADL generation operates on the abstract model
(AbstractResource).
      The abstract model has to be cloned and the non-supporting
resource methods removed.
      Then the WADL generation code can be reused on the clone.

3) The supporting OPTIONS methods need to be plugable so that you can
support your own implementation.

Paul.