/** * The provides an extension point. If you want to extend this and use a special dispatcher, * here is the place to do it. * <p> * @param attributes */ @Override public void initialize( RemoteHttpCacheAttributes attributes ) { setRemoteDispatcher( new RemoteHttpCacheDispatcher( attributes ) ); if ( log.isInfoEnabled() ) { log.info( "Created remote Dispatcher." + getRemoteDispatcher() ); } setInitialized( true ); }
/** * The provides an extension point. If you want to extend this and use a special dispatcher, * here is the place to do it. * <p> * @param attributes */ @Override public void initialize( RemoteHttpCacheAttributes attributes ) { setRemoteDispatcher( new RemoteHttpCacheDispatcher( attributes ) ); if ( log.isInfoEnabled() ) { log.info( "Created remote Dispatcher." + getRemoteDispatcher() ); } setInitialized( true ); }
/** * Verify that we don't get two ?'s */ public void testAddParameters_withQueryString() { // SETUP RemoteHttpCacheAttributes remoteHttpCacheAttributes = new RemoteHttpCacheAttributes(); RemoteHttpCacheDispatcher dispatcher = new RemoteHttpCacheDispatcher( remoteHttpCacheAttributes ); RemoteCacheRequest<String, String> remoteCacheRequest = new RemoteCacheRequest<String, String>(); remoteCacheRequest.setRequestType( RemoteRequestType.REMOVE_ALL ); String cacheName = "myCache"; remoteCacheRequest.setCacheName( cacheName ); String baseUrl = "http://localhost?thishasaquestionmark"; // DO WORK String result = dispatcher.addParameters( remoteCacheRequest, baseUrl ); // VERIFY assertEquals( "Wrong url", baseUrl + "&CacheName=" + cacheName + "&Key=&RequestType=REMOVE_ALL", result ); } }
/** * Verify that we don't get two ?'s */ public void testAddParameters_withQueryString() { // SETUP RemoteHttpCacheAttributes remoteHttpCacheAttributes = new RemoteHttpCacheAttributes(); RemoteHttpCacheDispatcher dispatcher = new RemoteHttpCacheDispatcher( remoteHttpCacheAttributes ); RemoteCacheRequest<String, String> remoteCacheRequest = new RemoteCacheRequest<String, String>(); remoteCacheRequest.setRequestType( RemoteRequestType.REMOVE_ALL ); String cacheName = "myCache"; remoteCacheRequest.setCacheName( cacheName ); String baseUrl = "http://localhost?thishasaquestionmark"; // DO WORK String result = dispatcher.addParameters( remoteCacheRequest, baseUrl ); // VERIFY assertEquals( "Wrong url", baseUrl + "&CacheName=" + cacheName + "&Key=&RequestType=REMOVE_ALL", result ); } }