|
From: Adrien <ad...@xc...> - 2015-10-28 15:05:12
|
Hi there, I will try to explain a bug, I'm not english so please be indulgent :D. I'm trying to implement a TimedInterceptor on my project like this one : https://github.com/xavierbourguignon/metrics-resteasy/blob/e7fe5326ab1b98616619f129813b89f49624b494/src/main/java/com/github/xavierbourguignon/metrics/resteasy/TimedInterceptor.java My problem, is when I have the method :filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) called, my timer is null because the TimedInterceptor is not pointing to the same object as before. I checked on RestEasy source to understand and I came up here :https://github.com/resteasy/Resteasy/blob/3.0.13.Final/jaxrs/resteasy-jaxrs/src/main/java/org/jboss/resteasy/core/ResourceMethodInvoker.java#L105L105 and L106, my requestFilters and responseFilters are pointing on the same object (TimedInterceptor). But at this line : https://github.com/resteasy/Resteasy/blob/3.0.13.Final/jaxrs/resteasy-jaxrs/src/main/java/org/jboss/resteasy/spi/ResteasyDeployment.java#L249 A new Singleton is added and that call "public void registryUpdated(JaxrsInterceptorRegistry registry)" on RessourceMethodInvoker. This function rebuild the filters, and by the way loosing my reference to TimedInterceptor... So I wonder why AcceptHeaderByFileSuffixFilter is added after ? Should be add before ? or maybe the (mediaTypeMappings != null) condition L249 should not pass we don't need this feature... Or maybe when we rebuild the filters, if it's already exist, juste reassign the previous object ? If I'm not clear, don't hesitate to tell meThank you Adrien Carreira +33(0) 677 452 813 |