clientRequestFactory = new ClientRequestFactory(
new ApacheHttpClientExecutor(new HttpClient(
new MultiThreadedHttpConnectionManager())), new URI(
photoServer));
ClientInterceptorRepositoryImpl interceptors = clientRequestFactory
.getPrefixInterceptors();
interceptors.registerInterceptor(new LoggingExecutionInterceptor());
interceptors.registerInterceptor(new CacheInterceptor(
new LightweightBrowserCache()));
interceptors.registerInterceptor(new ForceCachingExecutionInterceptor(
10));
// create a proxy using the JAX-RS annotation
photoResource = clientRequestFactory.createProxy(PhotoResource.class);
}