You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by di...@apache.org on 2021/07/26 16:15:09 UTC
[airavata-mft] branch develop updated: Setting the content type
header
This is an automated email from the ASF dual-hosted git repository.
dimuthuupe pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata-mft.git
The following commit(s) were added to refs/heads/develop by this push:
new e86d741 Setting the content type header
e86d741 is described below
commit e86d741221f6991cc1117b7524e704d81eeb8904
Author: Dimuthu Wannipurage <di...@gmail.com>
AuthorDate: Mon Jul 26 12:14:55 2021 -0400
Setting the content type header
---
.../java/org/apache/airavata/mft/agent/http/HttpServerHandler.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/agent/src/main/java/org/apache/airavata/mft/agent/http/HttpServerHandler.java b/agent/src/main/java/org/apache/airavata/mft/agent/http/HttpServerHandler.java
index 18fca15..a8a45df 100644
--- a/agent/src/main/java/org/apache/airavata/mft/agent/http/HttpServerHandler.java
+++ b/agent/src/main/java/org/apache/airavata/mft/agent/http/HttpServerHandler.java
@@ -107,7 +107,7 @@ public class HttpServerHandler extends SimpleChannelInboundHandler<FullHttpReque
HttpResponse response = new DefaultHttpResponse(HTTP_1_1, OK);
HttpUtil.setContentLength(response, fileLength);
- setContentTypeHeader(response, httpTransferRequest.getResourceId());
+ setContentTypeHeader(response, fileResourceMetadata.getFriendlyName());
if (HttpUtil.isKeepAlive(request)) {
response.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.KEEP_ALIVE);
@@ -192,7 +192,7 @@ public class HttpServerHandler extends SimpleChannelInboundHandler<FullHttpReque
}
private static void setContentTypeHeader(HttpResponse response, String path) {
- MimetypesFileTypeMap mimeTypesMap = new MimetypesFileTypeMap();
- response.headers().set(HttpHeaderNames.CONTENT_TYPE, path);
+ response.headers().set(HttpHeaderNames.CONTENT_TYPE, "application/octet-stream");
+ response.headers().set(HttpHeaderNames.CONTENT_DISPOSITION, "attachment; filename=\"" + path+ "\"");
}
}