From 23cb6497d0fa46590087aa5ce4b1006e7f3fbe47 Mon Sep 17 00:00:00 2001 From: Tsz-wo Sze Date: Wed, 26 Oct 2011 21:33:46 +0000 Subject: [PATCH] svn merge -c 1183081 from trunk for HDFS-2441. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1189483 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../web/resources/DatanodeWebHdfsMethods.java | 11 +++++++++++ .../web/resources/NamenodeWebHdfsMethods.java | 13 +++++++++++++ 3 files changed, 27 insertions(+) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 536e186a274..49c67e8bac8 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -1097,6 +1097,9 @@ Release 0.23.0 - Unreleased HDFS-2404. webhdfs liststatus json response is not correct. (suresh) + HDFS-2441. Remove the Content-Type set by HttpServer.QuotingInputFilter in + webhdfs responses. (szetszwo) + BREAKDOWN OF HDFS-1073 SUBTASKS HDFS-1521. Persist transaction ID on disk between NN restarts. diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/resources/DatanodeWebHdfsMethods.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/resources/DatanodeWebHdfsMethods.java index dd53da32793..c3d2fb46465 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/resources/DatanodeWebHdfsMethods.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/resources/DatanodeWebHdfsMethods.java @@ -27,6 +27,7 @@ import java.security.PrivilegedExceptionAction; import java.util.EnumSet; import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletResponse; import javax.ws.rs.Consumes; import javax.ws.rs.DefaultValue; import javax.ws.rs.GET; @@ -78,6 +79,7 @@ public class DatanodeWebHdfsMethods { public static final Log LOG = LogFactory.getLog(DatanodeWebHdfsMethods.class); private @Context ServletContext context; + private @Context HttpServletResponse response; /** Handle HTTP PUT request. */ @PUT @@ -108,6 +110,9 @@ public class DatanodeWebHdfsMethods { replication, blockSize)); } + //clear content type + response.setContentType(null); + return ugi.doAs(new PrivilegedExceptionAction() { @Override public Response run() throws IOException, URISyntaxException { @@ -164,6 +169,9 @@ public class DatanodeWebHdfsMethods { + Param.toSortedString(", ", bufferSize)); } + //clear content type + response.setContentType(null); + return ugi.doAs(new PrivilegedExceptionAction() { @Override public Response run() throws IOException { @@ -215,6 +223,9 @@ public class DatanodeWebHdfsMethods { + Param.toSortedString(", ", offset, length, bufferSize)); } + //clear content type + response.setContentType(null); + return ugi.doAs(new PrivilegedExceptionAction() { @Override public Response run() throws IOException { diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java index a624236a87e..7ee9eda5980 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java @@ -28,6 +28,7 @@ import java.util.EnumSet; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.DefaultValue; @@ -108,6 +109,7 @@ public class NamenodeWebHdfsMethods { private @Context ServletContext context; private @Context HttpServletRequest request; + private @Context HttpServletResponse response; private static DatanodeInfo chooseDatanode(final NameNode namenode, final String path, final HttpOpParam.Op op, final long openOffset @@ -226,6 +228,9 @@ public class NamenodeWebHdfsMethods { modificationTime, accessTime, renameOptions)); } + //clear content type + response.setContentType(null); + return ugi.doAs(new PrivilegedExceptionAction() { @Override public Response run() throws IOException, URISyntaxException { @@ -317,6 +322,9 @@ public class NamenodeWebHdfsMethods { + Param.toSortedString(", ", bufferSize)); } + //clear content type + response.setContentType(null); + return ugi.doAs(new PrivilegedExceptionAction() { @Override public Response run() throws IOException, URISyntaxException { @@ -394,6 +402,8 @@ public class NamenodeWebHdfsMethods { + Param.toSortedString(", ", offset, length, renewer, bufferSize)); } + //clear content type + response.setContentType(null); return ugi.doAs(new PrivilegedExceptionAction() { @Override @@ -522,6 +532,9 @@ public class NamenodeWebHdfsMethods { + Param.toSortedString(", ", recursive)); } + //clear content type + response.setContentType(null); + return ugi.doAs(new PrivilegedExceptionAction() { @Override public Response run() throws IOException {