users@jersey.java.net

Re: [Jersey] Filter configuration feature

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Fri, 17 Oct 2008 09:44:42 +0200

On Oct 16, 2008, at 6:50 PM, Craig Iverson wrote:

> First let me thank you for all the good work you guys are doing with
> jersey and jsr-311. It's been a pleasure to develop against.

Thanks!


>
> I have a feature request that I can add to the issue tracker if you
> agree.

Please. No need to ask permission to log issues :-)


> I think it would be great to be able to configure a filter per
> resource(s). In my case its even more than that, it would be more
> beneficial to also support an exclude list. I have a case where I
> only want certain filters applied to certain resources. I really
> want a couple of filters to always be applied except for on a couple
> of resources. The reason for the exclude list would allow other
> team members to add resources without worrying about configuring the
> filter for the new resource. Your thoughts?

Currently request and response filters are called before resource
matching is performed. Having filters apply to specific root resource
classes could also make sense, but i wonder if the exclude list
complicates matters, especially if there is more then one filter
present in the filter chain, rather than being explicit and describing
the list of resources with the list of filters e.g.

Map<List<Class<??>, List<ContainerRequestFilter>>

I am wondering if it is appropriate to have filters associated with
resources and resource methods configured from the resources
themselves. How about allowing the following:

@RequestFilters({A.class, B.class})
@Path("resource")
public class Resource {

@RequestFilters({C.class, D.class})
@GET
public String get() { ... }

@RequestFilters({E.class, F.class})
@Path("sub-resource")
public Object getSubResource() { ... }
}

Paul.

>
> Craig
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>