diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/DatasetDownloadServlet.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/DatasetDownloadServlet.java index d6cfb0746ccbd2af4272a44c560aaa4d42d76a9f..11d966da24bdf2deb82b1ce1737916c20e155a63 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/DatasetDownloadServlet.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/DatasetDownloadServlet.java @@ -351,9 +351,7 @@ public class DatasetDownloadServlet extends AbstractDatasetDownloadServlet RenderingContext newRenderingContext = new RenderingContext(renderingContext.getRootDir(), renderingContext .getUrlPrefix(), newRelativePath); - - renderPage(rendererFactory, response, dataSetCode, newRenderingContext, requestParams, - session); + autoResolveRedirect(response, newRenderingContext); } else if (AutoResolveUtils.continueAutoResolving(requestParams.tryGetMainDataSetPattern(), dir)) { @@ -366,15 +364,24 @@ public class DatasetDownloadServlet extends AbstractDatasetDownloadServlet RenderingContext newRenderingContext = new RenderingContext(renderingContext.getRootDir(), renderingContext .getUrlPrefix(), newRelativePath); - - renderPage(rendererFactory, response, dataSetCode, newRenderingContext, requestParams, - session); + autoResolveRedirect(response, newRenderingContext); } else { createPage(rendererFactory, response, dataSet, renderingContext, dir); } } + private static void autoResolveRedirect(HttpServletResponse response, + RenderingContext newContext) throws IOException + { + String newLocation = newContext.getUrlPrefix() + "/" + newContext.getRelativePathOrNull(); + if (operationLog.isInfoEnabled()) + { + operationLog.info("Auto resolve redirect: " + newLocation); + } + response.sendRedirect(response.encodeRedirectURL(newLocation)); + } + private void createPage(IRendererFactory rendererFactory, HttpServletResponse response, ExternalData dataSet, RenderingContext renderingContext, File file) throws IOException {