Les réponses ci-dessus ne sont pas 100% claires, alors c'est ce qui m'a aidé. J'avais une page statique 401.html et j'ai rencontré le même problème que l'affiche originale. Tout ce que j'ai fait était de changer la page en 401.la page jsp et vider ce droit en haut:
<%
String realmName = "A nice name to show as the title of on the pop-up";
response.setHeader("WWW-Authenticate","Basic realm=\"" + realmName + "\"");
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
%>
Le following post on coderanch.com servi de guide.
Donc, en résumé, la section pertinente de web.xml ressemble à ceci:
<!-- Internal server error. -->
<error-page>
<error-code>500</error-code>
<location>/errors/500.html</location>
</error-page>
<!-- Not found. -->
<error-page>
<error-code>404</error-code>
<location>/errors/404.html</location>
</error-page>
<!-- Unauthorized. -->
<error-page>
<error-code>401</error-code>
<location>/errors/401.jsp</location>
</error-page>
Et 401.jsp ressemble à ceci:
<%
String realmName = "A nice name to show as the title of on the pop-up";
response.setHeader("WWW-Authenticate","Basic realm=\"" + realmName + "\"");
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>401 Unauthorized</title>
<meta name="description" content="The server has not found anything matching the Request-URI.">
<style type="text/css">
body {background-color:ffffff;background-image:url(http://);background-repeat:no-repeat;background-position:top left;background-attachment:fixed;}
h3{font-family:Arial;color:000000;}
p {font-family:Arial;font-size:14px;font-style:normal;font-weight:normal;color:000000;}
</style>
</head>
<body>
<h3>401 Unauthorized</h3>
<p>The request requires authentication.</p>
</body>
</html>
tomcat est rien détournement d'avion, si ce retour la page de rapport d'état par défaut alors vous ne l'avez pas configurée correctement Il suffit de lire la documentation correcte – Peter
Je ne veux pas que tomcat affiche une quelconque page d'erreur –