diff --git a/hadoop-common-project/hadoop-auth/pom.xml b/hadoop-common-project/hadoop-auth/pom.xml
index e1309caeac7..057c47f9c96 100644
--- a/hadoop-common-project/hadoop-auth/pom.xml
+++ b/hadoop-common-project/hadoop-auth/pom.xml
@@ -193,11 +193,7 @@
guava
test
-
- org.eclipse.jetty
- jetty-server
-
-
+
diff --git a/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/server/AuthenticationFilter.java b/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/server/AuthenticationFilter.java
index 9f40c42d241..b339a5d5a24 100644
--- a/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/server/AuthenticationFilter.java
+++ b/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/server/AuthenticationFilter.java
@@ -19,7 +19,6 @@ import org.apache.hadoop.security.authentication.client.AuthenticatedURL;
import org.apache.hadoop.security.authentication.client.AuthenticationException;
import org.apache.hadoop.security.authentication.client.KerberosAuthenticator;
import org.apache.hadoop.security.authentication.util.*;
-import org.eclipse.jetty.server.Response;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -621,7 +620,7 @@ public class AuthenticationFilter implements Filter {
errCode = HttpServletResponse.SC_FORBIDDEN;
}
// After Jetty 9.4.21, sendError() no longer allows a custom message.
- // use setStatusWithReason() to set a custom message.
+ // use setStatus() to set a custom message.
String reason;
if (authenticationEx == null) {
reason = "Authentication required";
@@ -629,10 +628,7 @@ public class AuthenticationFilter implements Filter {
reason = authenticationEx.getMessage();
}
- if (httpResponse instanceof Response) {
- ((Response)httpResponse).setStatusWithReason(errCode, reason);
- }
-
+ httpResponse.setStatus(errCode, reason);
httpResponse.sendError(errCode, reason);
}
}