public JaxrsInterceptorRegistry<T> clone(ResteasyProviderFactory factory) { JaxrsInterceptorRegistry<T> clone = new JaxrsInterceptorRegistry(factory, intf); clone.interceptors.addAll(interceptors); return clone; }
public T[] postMatch(Class declaring, AccessibleObject target) { List<Match> matches = new ArrayList<Match>(); for (InterceptorFactory factory : interceptors) { Match match = factory.postMatch(declaring, target); if (match != null) { matches.add(match); } } return createArray(matches); }
@Override public ContainerRequestFilter[] postMatch(Class declaring, AccessibleObject target) { return super.postMatch(declaring, target); }
clientRequestFilters = parent.getClientRequestFilters().clone(this); clientRequestFilters.registerSingleton((ClientRequestFilter) provider, priority);
clientRequestFilters = parent.getClientRequestFilters().clone(this); clientRequestFilters.registerClass(provider, priority);
public synchronized void registerClass(Class<? extends T> declaring) { register(new OnDemandInterceptorFactory(declaring)); }
private T[] createArray(List<Match> matches) { sort(matches); T[] array = (T[]) Array.newInstance(intf, matches.size()); for (int i = 0; i < array.length; i++) { array[i] = (T) matches.get(i).interceptor; } return array; }
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 synchronized void registerSingleton(T interceptor) { register(new SingletonInterceptorFactory(interceptor.getClass(), interceptor)); }
public JaxrsInterceptorRegistry<T> clone(ResteasyProviderFactory factory) { JaxrsInterceptorRegistry<T> clone = new JaxrsInterceptorRegistry(factory, intf); clone.interceptors.addAll(interceptors); return clone; }
public synchronized void registerSingleton(T interceptor, int priority) { SingletonInterceptorFactory factory = new SingletonInterceptorFactory(interceptor.getClass(), interceptor); factory.setOrder(priority); register(factory); } }
public T[] preMatch() { if (cachedPreMatch == null) { List<Match> matches = new ArrayList<Match>(); for (InterceptorFactory factory : interceptors) { Match match = factory.preMatch(); if (match != null) { matches.add(match); } } cachedPreMatch = createArray(matches); } return cachedPreMatch; }
clientRequestFilters = new JaxrsInterceptorRegistry<ClientRequestFilter>(this, ClientRequestFilter.class); clientResponseFilters = new ClientResponseFilterRegistry(this); clientReaderInterceptorRegistry = new ReaderInterceptorRegistry(this, precedence);
public synchronized void registerClass(Class<? extends T> declaring, int priority) { OnDemandInterceptorFactory factory = new OnDemandInterceptorFactory(declaring); factory.setOrder(priority); register(factory); }
protected void initializeRegistriesAndFilters() { precedence = new LegacyPrecedence(); serverReaderInterceptorRegistry = new ReaderInterceptorRegistry(this, precedence); serverWriterInterceptorRegistry = new WriterInterceptorRegistry(this, precedence); containerRequestFilterRegistry = new ContainerRequestFilterRegistry(this, precedence); containerResponseFilterRegistry = new ContainerResponseFilterRegistry(this, precedence); clientRequestFilters = new JaxrsInterceptorRegistry<ClientRequestFilter>(this, ClientRequestFilter.class); clientResponseFilters = new ClientResponseFilterRegistry(this); clientReaderInterceptorRegistry = new ReaderInterceptorRegistry(this, precedence); clientWriterInterceptorRegistry = new WriterInterceptorRegistry(this, precedence); }