Revision 2f4ea617

b/src/gr/grnet/pithos/web/client/foldertree/FolderTreeViewModel.java
252 252

  
253 253
            @Override
254 254
            public void onError(Throwable t) {
255
                GWT.log("Error getting folder", t);
256
				app.setError(t);
257
                if (t instanceof RestException)
258
                    app.displayError("Error getting folder: " + ((RestException) t).getHttpStatusText());
259
                else
260
                    app.displayError("System error fetching folder: " + t.getMessage());
255
            	if (retries >= MAX_RETRIES) {
256
	                GWT.log("Error getting folder", t);
257
					app.setError(t);
258
	                if (t instanceof RestException)
259
	                    app.displayError("Error getting folder: " + ((RestException) t).getHttpStatusText());
260
	                else
261
	                    app.displayError("System error fetching folder: " + t.getMessage());
262
            	}
263
            	else {//retry
264
            		GWT.log("Retry " + retries);
265
            		Scheduler.get().scheduleDeferred(this);
266
            	}
261 267
            }
262 268

  
263 269
			@Override
264 270
			protected void onUnauthorized(Response response) {
265
				app.sessionExpired();
271
				if (retries >= MAX_RETRIES)
272
					app.sessionExpired();
273
            	else //retry
274
            		Scheduler.get().scheduleDeferred(this);
266 275
			}
267 276
        };
268 277
        getFolder.setHeader("X-Auth-Token", app.getToken());
b/src/gr/grnet/pithos/web/client/rest/GetRequest.java
48 48
import com.google.gwt.http.client.Response;
49 49

  
50 50
public abstract class GetRequest<T extends Resource> implements ScheduledCommand {
51
	
52
	protected static final int MAX_RETRIES = 3; 
53

  
54
	protected int retries = 0; 
51 55

  
52 56
	protected Class<T> aClass;
53 57

  
......
123 127
                    GetRequest.this.onUnauthorized(response);
124 128
				}
125 129
            });
130
            retries++;
126 131
        }
127 132
        catch (RequestException e) {
128 133
        }

Also available in: Unified diff