java - RESTEasy - Best practices to override service method to implement some generic logic across the different methods (like in servlet) -


ex: have common logic across different resources

@path("/rest") public class adduser {     @get    @path("/adduser/{ext}/{userid}")    @produces(mediatype.application_json)     public string adduser(@pathparam("tenantid") string tenantid, @pathparam("userid") integer userid) {     //i have common logic here  }   @path("/newrest") public class adduser1 {        @get     @path("/adduser/{ext}/{userid}")     @produces(mediatype.application_json)         public string adddifferentuser(@pathparam("tenantid") string tenantid,              @pathparam("userid") integer userid) {        //i have same common logic here   }  }  

which class can extend overwrite common logic bot rest services?

overriding service method not recommended should override service ?

take @ containerrequestfilter extension interface implemented container request filters. can handle common logic here.


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -