I have variant resources that all extend BaseResource<T>
@Component
@Path("/businesses")
public class BusinessResource extends BaseResource<Business>{
@GET
@Path({businessId}/)
public Business getBusiness(@PathParam("businessId") Integer businessId){..}
}
@Component
@Path("/clients")
public class ClientResource extends BaseResource<Client>{
@GET
@Path({clientId}/)
public Client getClient(@PathParam("clientId") Integer clientId){..}
}
I would like, that when there is a call to
/businesses/3, it will first go through a method that I will write which validates the T object and if everything is ok I will tell jersey to continue handling the resource.
Same goes for Client.
I can't use a regular servlet/filter - since it's being called BEFORE jersey servlet and I wouldn't know which resource is being called.
What is the best way to do it in Jersey?
Is there a place to interfere between knowing the method that jersey will invoke and the invokation?