public void registryUpdated(JaxrsInterceptorRegistry registry) { this.resourceMethodProviderFactory = new ResteasyProviderFactory(parentProviderFactory); for (DynamicFeature feature : parentProviderFactory.getServerDynamicFeatures()) { feature.configure(resourceInfo, new FeatureContextDelegate(resourceMethodProviderFactory)); } if (registry.getIntf().equals(WriterInterceptor.class)) { writerInterceptors = resourceMethodProviderFactory .getServerWriterInterceptorRegistry() .postMatch(method.getResourceClass().getClazz(), method.getAnnotatedMethod()); } else if (registry.getIntf().equals(ContainerRequestFilter.class)) { requestFilters = resourceMethodProviderFactory .getContainerRequestFilterRegistry() .postMatch(method.getResourceClass().getClazz(), method.getAnnotatedMethod()); } else if (registry.getIntf().equals(ContainerResponseFilter.class)) { responseFilters = resourceMethodProviderFactory .getContainerResponseFilterRegistry() .postMatch(method.getResourceClass().getClazz(), method.getAnnotatedMethod()); } }
public ResourceMethodInvoker( ResourceMethod method, InjectorFactory injector, ResourceFactory resource, ResteasyProviderFactory providerFactory) { this.injector = injector; this.resource = resource; this.parentProviderFactory = providerFactory; this.method = method; resourceInfo = new ResourceInfo() { @Override public Method getResourceMethod() { return ResourceMethodInvoker.this.method.getAnnotatedMethod(); } @Override public Class<?> getResourceClass() { return ResourceMethodInvoker.this.method.getResourceClass().getClazz(); } }; this.resourceMethodProviderFactory = new ResteasyProviderFactory(providerFactory); for (DynamicFeature feature : providerFactory.getServerDynamicFeatures()) { feature.configure(resourceInfo, new FeatureContextDelegate(resourceMethodProviderFactory)); } this.methodInjector = injector.createMethodInjector(method, resourceMethodProviderFactory); // hack for when message contentType == null // and @Consumes is on the class expectsBody = this.methodInjector.expectsBody(); requestFilters = resourceMethodProviderFactory .getContainerRequestFilterRegistry() .postMatch(method.getResourceClass().getClazz(), method.getAnnotatedMethod()); responseFilters = resourceMethodProviderFactory .getContainerResponseFilterRegistry() .postMatch(method.getResourceClass().getClazz(), method.getAnnotatedMethod()); writerInterceptors = resourceMethodProviderFactory .getServerWriterInterceptorRegistry() .postMatch(method.getResourceClass().getClazz(), method.getAnnotatedMethod()); // we register with parent to lisen for redeploy evens providerFactory.getContainerRequestFilterRegistry().getListeners().add(this); providerFactory.getContainerResponseFilterRegistry().getListeners().add(this); providerFactory.getServerWriterInterceptorRegistry().getListeners().add(this); ContextResolver<GeneralValidator> resolver = providerFactory.getContextResolver(GeneralValidator.class, MediaType.WILDCARD_TYPE); if (resolver != null) { validator = providerFactory .getContextResolver(GeneralValidator.class, MediaType.WILDCARD_TYPE) .getContext(null); } if (validator != null) { isValidatable = validator.isValidatable(getMethod().getDeclaringClass()); methodIsValidatable = validator.isMethodValidatable(getMethod()); } }
public Class<?> getResourceClass() { return method.getResourceClass().getClazz(); }