knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lmc...@apache.org
Subject git commit: KNOX-356 - change redirect servlet to use 307s instead of 302s
Date Tue, 29 Apr 2014 01:17:04 GMT
Repository: knox
Updated Branches:
  refs/heads/master 89c476068 -> 55f176d39


KNOX-356 - change redirect servlet to use 307s instead of 302s

Project: http://git-wip-us.apache.org/repos/asf/knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/55f176d3
Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/55f176d3
Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/55f176d3

Branch: refs/heads/master
Commit: 55f176d390920ea81a4d06a5a9349dbb9244de0b
Parents: 89c4760
Author: Larry McCay <lmccay@hortonworks.com>
Authored: Mon Apr 28 21:16:48 2014 -0400
Committer: Larry McCay <lmccay@hortonworks.com>
Committed: Mon Apr 28 21:16:48 2014 -0400

----------------------------------------------------------------------
 .../java/org/apache/hadoop/gateway/GatewayRedirectServlet.java   | 3 ++-
 .../org/apache/hadoop/gateway/GatewayRedirectServletTest.java    | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/55f176d3/gateway-server/src/main/java/org/apache/hadoop/gateway/GatewayRedirectServlet.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/hadoop/gateway/GatewayRedirectServlet.java
b/gateway-server/src/main/java/org/apache/hadoop/gateway/GatewayRedirectServlet.java
index 4c85c09..95b90ef 100644
--- a/gateway-server/src/main/java/org/apache/hadoop/gateway/GatewayRedirectServlet.java
+++ b/gateway-server/src/main/java/org/apache/hadoop/gateway/GatewayRedirectServlet.java
@@ -81,6 +81,7 @@ public class GatewayRedirectServlet extends HttpServlet{
     if (qstr != null && qstr.length() > 0) {
       location = location + "?" + qstr;
     }
-    response.sendRedirect(location);
+    response.setStatus(HttpServletResponse.SC_TEMPORARY_REDIRECT);
+    response.setHeader("Location", location);
   }
 } 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/knox/blob/55f176d3/gateway-server/src/test/java/org/apache/hadoop/gateway/GatewayRedirectServletTest.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/test/java/org/apache/hadoop/gateway/GatewayRedirectServletTest.java
b/gateway-server/src/test/java/org/apache/hadoop/gateway/GatewayRedirectServletTest.java
index 5019e9a..b015012 100644
--- a/gateway-server/src/test/java/org/apache/hadoop/gateway/GatewayRedirectServletTest.java
+++ b/gateway-server/src/test/java/org/apache/hadoop/gateway/GatewayRedirectServletTest.java
@@ -47,7 +47,9 @@ public class GatewayRedirectServletTest extends TestCase {
     EasyMock.expect(request.getPathInfo()).andReturn("/webhdfs/v1/tmp");
     EasyMock.expect(request.getQueryString()).andReturn("op=LISTSTATUS");
     EasyMock.expect(context.getContextPath()).andReturn("");
-    response.sendRedirect("/gateway/sandbox/webhdfs/v1/tmp?op=LISTSTATUS");
+    response.setStatus(307);
+    EasyMock.expectLastCall().once();
+    response.setHeader("Location", "/gateway/sandbox/webhdfs/v1/tmp?op=LISTSTATUS");
     EasyMock.expectLastCall().once();
     // logging
     context.log((String)EasyMock.anyObject());


Mime
View raw message