/** * Make a raw ClientRequest cache results in the provided cache. * * @param request * @param cache */ public static void makeCacheable( ClientInterceptorRepository interceptorRepository, BrowserCache cache) { interceptorRepository.getExecutionInterceptorList().addFirst( new CacheInterceptor(cache)); } }
/** * Make a raw ClientRequest cache results in the provided cache. * * @param request * @param cache */ public static void makeCacheable( ClientInterceptorRepository interceptorRepository, BrowserCache cache) { interceptorRepository.getExecutionInterceptorList().addFirst( new CacheInterceptor(cache)); } }
/** * Makes the client proxy cacheable. This method allows you to pass in a * shared cache that the proxy should use * * @param clientProxy * @param cache */ public static void makeCacheable(Object clientProxy, BrowserCache cache) { final CacheInterceptor interceptor = new CacheInterceptor(cache); ResteasyClientProxy proxy = (ResteasyClientProxy) clientProxy; proxy.applyClientInvokerModifier(new ClientInvokerModifier() { public void modify(ClientInvoker invoker) { if (invoker.getHttpMethod().equalsIgnoreCase("GET")) { invoker.getExecutionInterceptorList().addFirst(interceptor); } } }); }
/** * Makes the client proxy cacheable. This method allows you to pass in a * shared cache that the proxy should use * * @param clientProxy * @param cache */ public static void makeCacheable(Object clientProxy, BrowserCache cache) { final CacheInterceptor interceptor = new CacheInterceptor(cache); ResteasyClientProxy proxy = (ResteasyClientProxy) clientProxy; proxy.applyClientInvokerModifier(new ClientInvokerModifier() { public void modify(ClientInvoker invoker) { if (invoker.getHttpMethod().equalsIgnoreCase("GET")) { invoker.getExecutionInterceptorList().addFirst(interceptor); } } }); }
proxyFactory.registerPrefixInterceptor(new CacheInterceptor(cache));