Added encode for filename
Fixed logger git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-transfer/uri-resolver@122560 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
5189be3d57
commit
72b045c748
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.gcube.datatransfer.resolver;
|
package org.gcube.datatransfer.resolver;
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
* Nov 20, 2015
|
* Nov 20, 2015
|
||||||
*/
|
*/
|
||||||
|
@ -47,7 +47,7 @@ public class UriResolverRewriteFilter implements Filter{
|
||||||
if (queryString == null) { // IS A /XXXXX
|
if (queryString == null) { // IS A /XXXXX
|
||||||
logger.debug("QueryString is null, is It a new SMP public uri by ID?");
|
logger.debug("QueryString is null, is It a new SMP public uri by ID?");
|
||||||
int lastSlash = requestURI.lastIndexOf("/");
|
int lastSlash = requestURI.lastIndexOf("/");
|
||||||
if ((lastSlash + 1) == requestURI.length()) {
|
if (lastSlash + 1 == requestURI.length()) {
|
||||||
logger.debug("'/' is last index, doFilter Request");
|
logger.debug("'/' is last index, doFilter Request");
|
||||||
// req.getRequestDispatcher("/").forward(req, res);
|
// req.getRequestDispatcher("/").forward(req, res);
|
||||||
chain.doFilter(req, res);
|
chain.doFilter(req, res);
|
||||||
|
@ -57,7 +57,7 @@ public class UriResolverRewriteFilter implements Filter{
|
||||||
// String newURI = requestURI.replace(toReplace,
|
// String newURI = requestURI.replace(toReplace,
|
||||||
// SERVLET_RESOLVER_BY_ID+"?"+SMP_ID+"="+toReplace);
|
// SERVLET_RESOLVER_BY_ID+"?"+SMP_ID+"="+toReplace);
|
||||||
String newURI = SERVLET_RESOLVER_BY_ID + "?" + SMP_ID + "=" + toStorageID;
|
String newURI = SERVLET_RESOLVER_BY_ID + "?" + SMP_ID + "=" + toStorageID;
|
||||||
logger.debug("forward to: " + requestURI + newURI);
|
logger.debug("forward to: " + newURI);
|
||||||
req.getRequestDispatcher(newURI).forward(req, res);
|
req.getRequestDispatcher(newURI).forward(req, res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package org.gcube.datatransfer.resolver.http;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
|
||||||
import javax.servlet.ServletConfig;
|
import javax.servlet.ServletConfig;
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
|
@ -147,7 +148,7 @@ public class StorageIDResolver extends HttpServlet {
|
||||||
if(contentType==null || contentType.isEmpty())
|
if(contentType==null || contentType.isEmpty())
|
||||||
contentType = ConstantsHttpResolver.DEFAULT_CONTENTTYPE_UNKNOWN_UNKNOWN;
|
contentType = ConstantsHttpResolver.DEFAULT_CONTENTTYPE_UNKNOWN_UNKNOWN;
|
||||||
|
|
||||||
response.addHeader(ConstantsHttpResolver.CONTENT_DISPOSITION, "attachment; filename=" +fileName);
|
response.addHeader(ConstantsHttpResolver.CONTENT_DISPOSITION, "attachment; filename=" +URLEncoder.encode(fileName, "UTF-8"));
|
||||||
response.setContentType(contentType);
|
response.setContentType(contentType);
|
||||||
|
|
||||||
//CASE VALIDATION
|
//CASE VALIDATION
|
||||||
|
|
Loading…
Reference in New Issue