aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wfar...@apache.org
Subject aurora git commit: Perform leader redirect using HTTP status code 307.
Date Wed, 08 Jul 2015 21:56:25 GMT
Repository: aurora
Updated Branches:
  refs/heads/master 16f85d01e -> 8efcd0698


Perform leader redirect using HTTP status code 307.

Reviewed at https://reviews.apache.org/r/36064/


Project: http://git-wip-us.apache.org/repos/asf/aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/8efcd069
Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/8efcd069
Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/8efcd069

Branch: refs/heads/master
Commit: 8efcd069886b46bc180c9132faacfdc755c87d8e
Parents: 16f85d0
Author: Stephan Erb <stephan@dev.static-void.de>
Authored: Wed Jul 8 14:56:03 2015 -0700
Committer: Bill Farner <wfarner@apache.org>
Committed: Wed Jul 8 14:56:03 2015 -0700

----------------------------------------------------------------------
 .../org/apache/aurora/scheduler/http/LeaderRedirectFilter.java   | 4 +++-
 .../java/org/apache/aurora/scheduler/http/ServletFilterTest.java | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aurora/blob/8efcd069/src/main/java/org/apache/aurora/scheduler/http/LeaderRedirectFilter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/http/LeaderRedirectFilter.java b/src/main/java/org/apache/aurora/scheduler/http/LeaderRedirectFilter.java
index 1c2b08d..51566e9 100644
--- a/src/main/java/org/apache/aurora/scheduler/http/LeaderRedirectFilter.java
+++ b/src/main/java/org/apache/aurora/scheduler/http/LeaderRedirectFilter.java
@@ -21,6 +21,7 @@ import javax.servlet.FilterChain;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import javax.ws.rs.core.HttpHeaders;
 
 import com.google.common.base.Optional;
 
@@ -42,7 +43,8 @@ public class LeaderRedirectFilter extends AbstractFilter {
 
     Optional<String> leaderRedirect = redirector.getRedirectTarget(request);
     if (leaderRedirect.isPresent()) {
-      response.sendRedirect(leaderRedirect.get());
+      response.setStatus(HttpServletResponse.SC_TEMPORARY_REDIRECT);
+      response.setHeader(HttpHeaders.LOCATION, leaderRedirect.get());
     } else {
       chain.doFilter(request, response);
     }

http://git-wip-us.apache.org/repos/asf/aurora/blob/8efcd069/src/test/java/org/apache/aurora/scheduler/http/ServletFilterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/http/ServletFilterTest.java b/src/test/java/org/apache/aurora/scheduler/http/ServletFilterTest.java
index f8b134f..94c6b2a 100644
--- a/src/test/java/org/apache/aurora/scheduler/http/ServletFilterTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/http/ServletFilterTest.java
@@ -112,7 +112,7 @@ public class ServletFilterTest extends JettyServerModuleTest {
     leaderRedirectSmokeTest(Status.OK);
 
     setLeadingScheduler("otherHost", 1234);
-    leaderRedirectSmokeTest(Status.FOUND);
+    leaderRedirectSmokeTest(Status.TEMPORARY_REDIRECT);
     assertResponseStatus("/", Status.OK);
   }
 }


Mime
View raw message