session expired handled
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@81048 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
0fa3e750cc
commit
d8f2c9e483
|
@ -74,6 +74,8 @@ import org.gcube.portlets.user.workspace.client.event.SelectedItemEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.SelectedItemEventHandler;
|
import org.gcube.portlets.user.workspace.client.event.SelectedItemEventHandler;
|
||||||
import org.gcube.portlets.user.workspace.client.event.SendMessageEvent;
|
import org.gcube.portlets.user.workspace.client.event.SendMessageEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.SendMessageEventHandler;
|
import org.gcube.portlets.user.workspace.client.event.SendMessageEventHandler;
|
||||||
|
import org.gcube.portlets.user.workspace.client.event.SessionExpiredEvent;
|
||||||
|
import org.gcube.portlets.user.workspace.client.event.SessionExpiredEventHandler;
|
||||||
import org.gcube.portlets.user.workspace.client.event.SmartFolderSelectedEvent;
|
import org.gcube.portlets.user.workspace.client.event.SmartFolderSelectedEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.SmartFolderSelectedEventHandler;
|
import org.gcube.portlets.user.workspace.client.event.SmartFolderSelectedEventHandler;
|
||||||
import org.gcube.portlets.user.workspace.client.event.SubTreeLoadedEvent;
|
import org.gcube.portlets.user.workspace.client.event.SubTreeLoadedEvent;
|
||||||
|
@ -362,6 +364,15 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//********EVENTS TO NOTIFY SUBSCRIBERS
|
||||||
|
eventBus.addHandler(SessionExpiredEvent.TYPE, new SessionExpiredEventHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSessionExpired(SessionExpiredEvent sessionExpiredEvent) {
|
||||||
|
notifySubscriber(sessionExpiredEvent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
eventBus.addHandler(WebDavUrlEvent.TYPE, new WebDavUrlEventHandler() {
|
eventBus.addHandler(WebDavUrlEvent.TYPE, new WebDavUrlEventHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1656,6 +1667,12 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
|
|
||||||
sub.fileDownloaded(messageEvent.getItemIdentifier());
|
sub.fileDownloaded(messageEvent.getItemIdentifier());
|
||||||
|
|
||||||
|
}else if(event instanceof SessionExpiredEvent){
|
||||||
|
|
||||||
|
SessionExpiredEvent sessionEvent = (SessionExpiredEvent) event;
|
||||||
|
|
||||||
|
sub.viewSessionExpiredPanel();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
package org.gcube.portlets.user.workspace.client.event;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.workspace.client.interfaces.EventsTypeEnum;
|
||||||
|
import org.gcube.portlets.user.workspace.client.interfaces.GuiEventInterface;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* @Sep 4, 2013
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SessionExpiredEvent extends GwtEvent<SessionExpiredEventHandler> implements GuiEventInterface {
|
||||||
|
public static Type<SessionExpiredEventHandler> TYPE = new Type<SessionExpiredEventHandler>();
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Type<SessionExpiredEventHandler> getAssociatedType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void dispatch(SessionExpiredEventHandler handler) {
|
||||||
|
handler.onSessionExpired(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.gcube.portlets.user.workspace.client.interfaces.GuiEventInterface#getKey()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public EventsTypeEnum getKey() {
|
||||||
|
return EventsTypeEnum.SESSION_EXPIRED;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package org.gcube.portlets.user.workspace.client.event;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* @Sep 4, 2013
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface SessionExpiredEventHandler extends EventHandler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param sessionExpiredEvent
|
||||||
|
*/
|
||||||
|
void onSessionExpired(SessionExpiredEvent sessionExpiredEvent);
|
||||||
|
}
|
|
@ -26,5 +26,6 @@ public enum EventsTypeEnum
|
||||||
SELECTED_MESSAGE,
|
SELECTED_MESSAGE,
|
||||||
CREATE_NEW_MESSAGE,
|
CREATE_NEW_MESSAGE,
|
||||||
REPLY_FORWARD_MESSAGE,
|
REPLY_FORWARD_MESSAGE,
|
||||||
FILE_DOWNLAD_EVENT
|
FILE_DOWNLAD_EVENT,
|
||||||
|
SESSION_EXPIRED
|
||||||
}
|
}
|
|
@ -38,5 +38,9 @@ public interface SubscriberInterface {
|
||||||
* @param itemIdentifier
|
* @param itemIdentifier
|
||||||
*/
|
*/
|
||||||
void fileDownloaded(String itemIdentifier);
|
void fileDownloaded(String itemIdentifier);
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void viewSessionExpiredPanel();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.gcube.portlets.user.workspace.client.model.ScopeModel;
|
||||||
import org.gcube.portlets.user.workspace.client.model.SmartFolderModel;
|
import org.gcube.portlets.user.workspace.client.model.SmartFolderModel;
|
||||||
import org.gcube.portlets.user.workspace.client.model.SubTree;
|
import org.gcube.portlets.user.workspace.client.model.SubTree;
|
||||||
import org.gcube.portlets.user.workspace.client.workspace.GWTWorkspaceItem;
|
import org.gcube.portlets.user.workspace.client.workspace.GWTWorkspaceItem;
|
||||||
|
import org.gcube.portlets.user.workspace.shared.SessionExpiredException;
|
||||||
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
|
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
|
||||||
|
|
||||||
import com.google.gwt.user.client.rpc.RemoteService;
|
import com.google.gwt.user.client.rpc.RemoteService;
|
||||||
|
@ -31,9 +32,9 @@ public interface GWTWorkspaceService extends RemoteService{
|
||||||
|
|
||||||
public List<ScopeModel> getAllScope() throws Exception;
|
public List<ScopeModel> getAllScope() throws Exception;
|
||||||
|
|
||||||
public List<FileModel> getFolderChildren(FolderModel folder) throws Exception;
|
public List<FileModel> getFolderChildren(FolderModel folder) throws Exception, SessionExpiredException;
|
||||||
|
|
||||||
public List<FileGridModel> getFolderChildrenForFileGrid(FileModel folder) throws Exception;
|
public List<FileGridModel> getFolderChildrenForFileGrid(FileModel folder) throws Exception, SessionExpiredException;
|
||||||
|
|
||||||
public FileDetailsModel getDetailsFile(FileModel item) throws Exception;
|
public FileDetailsModel getDetailsFile(FileModel item) throws Exception;
|
||||||
|
|
||||||
|
@ -156,7 +157,7 @@ public interface GWTWorkspaceService extends RemoteService{
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
List<FileGridModel> getFolderChildrenForFileGridById(String folderId) throws Exception;
|
List<FileGridModel> getFolderChildrenForFileGridById(String folderId) throws Exception, SessionExpiredException;
|
||||||
|
|
||||||
String getShortUrl(String longUrl) throws Exception;
|
String getShortUrl(String longUrl) throws Exception;
|
||||||
|
|
||||||
|
|
|
@ -10,10 +10,12 @@ import org.gcube.portlets.user.workspace.client.constant.WorkspaceOperation;
|
||||||
import org.gcube.portlets.user.workspace.client.event.ExpandFolderEvent;
|
import org.gcube.portlets.user.workspace.client.event.ExpandFolderEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.MoveItemEvent;
|
import org.gcube.portlets.user.workspace.client.event.MoveItemEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.SelectedItemEvent;
|
import org.gcube.portlets.user.workspace.client.event.SelectedItemEvent;
|
||||||
|
import org.gcube.portlets.user.workspace.client.event.SessionExpiredEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.model.FileModel;
|
import org.gcube.portlets.user.workspace.client.model.FileModel;
|
||||||
import org.gcube.portlets.user.workspace.client.model.FolderModel;
|
import org.gcube.portlets.user.workspace.client.model.FolderModel;
|
||||||
import org.gcube.portlets.user.workspace.client.resources.Resources;
|
import org.gcube.portlets.user.workspace.client.resources.Resources;
|
||||||
import org.gcube.portlets.user.workspace.client.view.windows.MessageBoxAlert;
|
import org.gcube.portlets.user.workspace.client.view.windows.MessageBoxAlert;
|
||||||
|
import org.gcube.portlets.user.workspace.shared.SessionExpiredException;
|
||||||
|
|
||||||
import com.extjs.gxt.ui.client.Style.SelectionMode;
|
import com.extjs.gxt.ui.client.Style.SelectionMode;
|
||||||
import com.extjs.gxt.ui.client.data.ModelData;
|
import com.extjs.gxt.ui.client.data.ModelData;
|
||||||
|
@ -736,6 +738,12 @@ public class AsyncTreePanel extends LayoutContainer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
|
|
||||||
|
if(caught instanceof SessionExpiredException){
|
||||||
|
eventBus.fireEvent(new SessionExpiredEvent());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR + " getting folder children items. " +ConstantsExplorer.TRY_AGAIN, null);
|
new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR + " getting folder children items. " +ConstantsExplorer.TRY_AGAIN, null);
|
||||||
removeAllAndRecoveryRoot();
|
removeAllAndRecoveryRoot();
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,7 @@ import org.gcube.portlets.user.workspace.server.util.StringUtil;
|
||||||
import org.gcube.portlets.user.workspace.server.util.UserUtil;
|
import org.gcube.portlets.user.workspace.server.util.UserUtil;
|
||||||
import org.gcube.portlets.user.workspace.server.util.WsUtil;
|
import org.gcube.portlets.user.workspace.server.util.WsUtil;
|
||||||
import org.gcube.portlets.user.workspace.server.util.scope.ScopeUtilFilter;
|
import org.gcube.portlets.user.workspace.server.util.scope.ScopeUtilFilter;
|
||||||
|
import org.gcube.portlets.user.workspace.shared.SessionExpiredException;
|
||||||
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingEntryType;
|
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingEntryType;
|
||||||
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
|
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
|
||||||
import org.gcube.portlets.user.workspaceapplicationhandler.ApplicationReaderFromGenericResource;
|
import org.gcube.portlets.user.workspaceapplicationhandler.ApplicationReaderFromGenericResource;
|
||||||
|
@ -231,12 +232,15 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<FileModel> getFolderChildren(FolderModel folder) throws Exception{
|
public List<FileModel> getFolderChildren(FolderModel folder) throws Exception, SessionExpiredException{
|
||||||
|
|
||||||
Workspace workspace;
|
Workspace workspace;
|
||||||
|
|
||||||
|
if(isSessionExpired())
|
||||||
|
throw new SessionExpiredException();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
workspace = getWorkspace();
|
workspace = getWorkspace();
|
||||||
|
|
||||||
List<FileModel> listFileModels = new ArrayList<FileModel>();
|
List<FileModel> listFileModels = new ArrayList<FileModel>();
|
||||||
|
@ -262,9 +266,12 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<FileGridModel> getFolderChildrenForFileGrid(FileModel folder) throws Exception {
|
public List<FileGridModel> getFolderChildrenForFileGrid(FileModel folder) throws Exception, SessionExpiredException {
|
||||||
Workspace workspace;
|
Workspace workspace;
|
||||||
|
|
||||||
|
if(isSessionExpired())
|
||||||
|
throw new SessionExpiredException();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
workspace = getWorkspace();
|
workspace = getWorkspace();
|
||||||
|
@ -309,6 +316,9 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
|
|
||||||
Workspace workspace;
|
Workspace workspace;
|
||||||
|
|
||||||
|
if(isSessionExpired())
|
||||||
|
throw new SessionExpiredException();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class);
|
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.workspace.shared;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* @Sep 4, 2013
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SessionExpiredException extends Exception{
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 8423680645305738442L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public SessionExpiredException() {
|
||||||
|
super("Session expired");
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue