Removed is session expired from external servlet

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@141388 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2016-12-22 16:37:11 +00:00
parent cabdf54222
commit e7a9d05e68
2 changed files with 15 additions and 15 deletions

View File

@ -18,9 +18,7 @@ import org.apache.commons.io.IOUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer; import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
import org.gcube.portlets.user.workspace.server.property.PortalUrlGroupGatewayProperty; import org.gcube.portlets.user.workspace.server.property.PortalUrlGroupGatewayProperty;
import org.gcube.portlets.user.workspace.server.util.WsUtil;
import org.gcube.portlets.user.workspace.shared.HandlerResultMessage; import org.gcube.portlets.user.workspace.shared.HandlerResultMessage;
import org.gcube.portlets.user.workspace.shared.SessionExpiredException;
/** /**
* @author M. Assante, CNR-ISTI * @author M. Assante, CNR-ISTI
@ -43,16 +41,17 @@ public class DownloadFolderServlet extends HttpServlet{
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
boolean urlRedirectOnError = req.getParameter(ConstantsExplorer.REDIRECTONERROR)==null?false:req.getParameter(ConstantsExplorer.REDIRECTONERROR).equals("true"); boolean urlRedirectOnError = req.getParameter(ConstantsExplorer.REDIRECTONERROR)==null?false:req.getParameter(ConstantsExplorer.REDIRECTONERROR).equals("true");
try { //REMOVED BECAUSE IT DOES NOT WORK. MUST BE CHECK USERID AND CONTEXTID
if(WsUtil.isSessionExpired(req)) // try {
throw new SessionExpiredException(); // if(WsUtil.isSessionExpired(req))
} catch (Exception e) { // throw new SessionExpiredException();
// } catch (Exception e) {
if (e instanceof SessionExpiredException){ //
sendErrorForStatus(resp, HttpServletResponse.SC_UNAUTHORIZED +": Session expired", HttpServletResponse.SC_UNAUTHORIZED); // if (e instanceof SessionExpiredException){
return; // sendErrorForStatus(resp, HttpServletResponse.SC_UNAUTHORIZED +": Session expired", HttpServletResponse.SC_UNAUTHORIZED);
} // return;
} // }
// }
String fileRelativePath = req.getParameter("filepath"); String fileRelativePath = req.getParameter("filepath");
String tmpDir = System.getProperty("java.io.tmpdir"); String tmpDir = System.getProperty("java.io.tmpdir");

View File

@ -85,9 +85,10 @@ public class DownloadServlet extends HttpServlet{
logger.debug("FILE DOWNLOAD REQUEST "+itemId); logger.debug("FILE DOWNLOAD REQUEST "+itemId);
Workspace wa = null; Workspace wa = null;
try { try {
//ADDED 13-01-2014 SESSION VALIDATION //REMOVED BECAUSE IT DOES NOT WORK. MUST BE CHECK USERID AND CONTEXTID
if(WsUtil.isSessionExpired(req)) // //ADDED 13-01-2014 SESSION VALIDATION
throw new SessionExpiredException(); // if(WsUtil.isSessionExpired(req))
// throw new SessionExpiredException();
wa = WsUtil.getWorkspace(req, contextID, userID); wa = WsUtil.getWorkspace(req, contextID, userID);
} catch (Exception e) { } catch (Exception e) {