Author: pmouawad
Date: Thu Mar 17 19:14:39 2016
New Revision: 1735477

URL: http://svn.apache.org/viewvc?rev=1735477&view=rev
Log:
Use constants with significant names

Modified:
    
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java
    
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPConstantsInterface.java

Modified: 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java?rev=1735477&r1=1735476&r2=1735477&view=diff
==============================================================================
--- 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java
 (original)
+++ 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java
 Thu Mar 17 19:14:39 2016
@@ -113,7 +113,9 @@ public class HTTPSampleResult extends Sa
          * 305 = Use Proxy
          * 306 = (Unused)
          */
-        final String[] REDIRECT_CODES = { "301", "302", "303" };
+        final String[] REDIRECT_CODES = { HTTPConstants.SC_MOVED_PERMANENTLY,
+                HTTPConstants.SC_MOVED_TEMPORARILY,
+                HTTPConstants.SC_SEE_OTHER };
         String code = getResponseCode();
         for (String redirectCode : REDIRECT_CODES) {
             if (redirectCode.equals(code)) {
@@ -125,7 +127,7 @@ public class HTTPSampleResult extends Sa
         // the user agent MUST NOT automatically redirect the request unless 
it can be confirmed by the user,
         // since this might change the conditions under which the request was 
issued.
         // See Bug 54119
-        if ("307".equals(code) && 
+        if (HTTPConstants.SC_TEMPORARY_REDIRECT.equals(code) && 
                 (HTTPConstants.GET.equals(getHTTPMethod()) || 
HTTPConstants.HEAD.equals(getHTTPMethod()))) {
             return true;
         }

Modified: 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPConstantsInterface.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPConstantsInterface.java?rev=1735477&r1=1735476&r2=1735477&view=diff
==============================================================================
--- 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPConstantsInterface.java
 (original)
+++ 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPConstantsInterface.java
 Thu Mar 17 19:14:39 2016
@@ -24,7 +24,11 @@ package org.apache.jmeter.protocol.http.
  */
 
 public interface HTTPConstantsInterface { // CHECKSTYLE IGNORE InterfaceIsType
-
+    String SC_MOVED_PERMANENTLY = "301";
+    String SC_MOVED_TEMPORARILY = "302";
+    String SC_SEE_OTHER = "303";
+    String SC_TEMPORARY_REDIRECT = "307";
+            
     int DEFAULT_HTTPS_PORT = 443;
     String DEFAULT_HTTPS_PORT_STRING = "443"; // $NON-NLS-1$
     int    DEFAULT_HTTP_PORT = 80;


Reply via email to