Fixed #6096
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-uploader@135164 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
c1a735694f
commit
a3e19f3afa
|
@ -1,5 +1,6 @@
|
|||
package org.gcube.portlets.widgets.workspaceuploader.server;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.gcube.common.homelibary.model.items.type.WorkspaceItemType;
|
||||
|
@ -61,7 +62,7 @@ public class WorkspaceUploaderServiceImpl extends RemoteServiceServlet implement
|
|||
|
||||
logger.info("returning uploader: "+uploader.getClientUploadKey() +" status: "+uploader.getUploadStatus() +", file: "+uploader.getFile().toString() +", progress: "+progress);
|
||||
|
||||
checkUploaderErasable(getThreadLocalRequest().getSession(), uploader);
|
||||
checkUploaderErasable(this.getThreadLocalRequest(), uploader);
|
||||
return uploader;
|
||||
|
||||
}
|
||||
|
@ -73,7 +74,7 @@ public class WorkspaceUploaderServiceImpl extends RemoteServiceServlet implement
|
|||
* @param httpSession the http session
|
||||
* @param uploader the uploader
|
||||
*/
|
||||
private void checkUploaderErasable(final HttpSession httpSession, final WorkspaceUploaderItem uploader){
|
||||
private void checkUploaderErasable(final HttpServletRequest httpRequest, final WorkspaceUploaderItem uploader){
|
||||
logger.trace("Checking Uploader erasable...");
|
||||
|
||||
if(uploader==null){
|
||||
|
@ -81,13 +82,15 @@ public class WorkspaceUploaderServiceImpl extends RemoteServiceServlet implement
|
|||
return;
|
||||
}
|
||||
|
||||
final HttpSession session = httpRequest.getSession();
|
||||
|
||||
new Thread(){
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
|
||||
logger.trace("Uploader: "+uploader.getClientUploadKey() +", is erasable?");
|
||||
WsUtil.eraseWorkspaceUploaderInSession(getThreadLocalRequest(), uploader);
|
||||
logger.trace("Uploader: "+uploader.getClientUploadKey() +", is erasable? "+uploader.isErasable());
|
||||
WsUtil.eraseWorkspaceUploaderInSession(session, uploader);
|
||||
}
|
||||
catch (Exception e) {
|
||||
logger.warn("Error during checkUploaderErasable: ", e);
|
||||
|
|
|
@ -7,7 +7,6 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.gcube.common.homelibrary.home.HomeLibrary;
|
||||
import org.gcube.common.homelibrary.home.exceptions.HomeNotFoundException;
|
||||
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
|
||||
|
@ -141,18 +140,14 @@ public class WsUtil {
|
|||
* @param uploader the uploader
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public static void eraseWorkspaceUploaderInSession(final HttpServletRequest request, WorkspaceUploaderItem uploader) throws Exception
|
||||
public static void eraseWorkspaceUploaderInSession(final HttpSession httpSession, WorkspaceUploaderItem uploader) throws Exception
|
||||
{
|
||||
logger.trace("Erase WorkspaceUploader workspace uploader in session: "+uploader.getIdentifier() + ", erasable? "+uploader.isErasable());
|
||||
|
||||
|
||||
if(uploader==null || uploader.getIdentifier()==null || uploader.getIdentifier().isEmpty())
|
||||
throw new Exception("Invalid uploader");
|
||||
|
||||
HttpSession httpSession = request.getSession();
|
||||
|
||||
if(uploader.isErasable()){
|
||||
// session.setAttribute(uploader.getIdentifier(), null);
|
||||
httpSession.removeAttribute(uploader.getIdentifier());
|
||||
logger.info("Erased uploader: "+uploader.getIdentifier());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue