Skip to content
Snippets Groups Projects
Commit 01a2333a authored by anttil's avatar anttil
Browse files

SSDM-3863: Custom Import (Async/Background) fails

SVN: 36824
parent ef7a1ab2
No related branches found
No related tags found
No related merge requests found
...@@ -32,6 +32,8 @@ import javax.annotation.Resource; ...@@ -32,6 +32,8 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import ch.systemsx.cisd.common.exceptions.ExceptionUtils; import ch.systemsx.cisd.common.exceptions.ExceptionUtils;
import ch.systemsx.cisd.common.exceptions.UserFailureException; import ch.systemsx.cisd.common.exceptions.UserFailureException;
...@@ -2738,7 +2740,8 @@ public final class CommonClientService extends AbstractClientService implements ...@@ -2738,7 +2740,8 @@ public final class CommonClientService extends AbstractClientService implements
HttpSession httpSession = getHttpSession(); HttpSession httpSession = getHttpSession();
UploadedFilesBean uploadedFiles = null; UploadedFilesBean uploadedFiles = null;
ConsumerTask asyncCustomImportTask = null; ConsumerTask asyncCustomImportTask = null;
final RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
final String sessionId = getSessionToken();
try try
{ {
uploadedFiles = (UploadedFilesBean) httpSession.getAttribute(sessionKey); uploadedFiles = (UploadedFilesBean) httpSession.getAttribute(sessionKey);
...@@ -2765,10 +2768,11 @@ public final class CommonClientService extends AbstractClientService implements ...@@ -2765,10 +2768,11 @@ public final class CommonClientService extends AbstractClientService implements
@Override @Override
public void doActionOrThrowException(Writer writer) public void doActionOrThrowException(Writer writer)
{ {
RequestContextHolder.setRequestAttributes(requestAttributes);
// Some stuff is repeated on the async executor, this is expected // Some stuff is repeated on the async executor, this is expected
CustomImportFile customImportFileAsync = getCustomImportFile(this.getFilesForTask()); CustomImportFile customImportFileAsync = getCustomImportFile(this.getFilesForTask());
// Execute task // Execute task
commonServer.performCustomImport(getSessionToken(), customImportCode, customImportFileAsync); commonServer.performCustomImport(sessionId, customImportCode, customImportFileAsync);
} }
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment