Ví dụ sau cho thấy cách mã lỗi 407 được gửi đến trình duyệt máy khách. Sau đó, trình duyệt sẽ hiển thị cho bạn " Cần xác thực !!! "tin nhắn.
<html>
<head>
<title>Setting HTTP Status Code</title>
</head>
<body>
<%
// Set error code and reason.
response.sendError(407, "Need authentication!!!" );
%>
</body>
</html> Bạn sẽ nhận được kết quả sau -
HTTP Status 407 - Need authentication!!!
type Status report
message Need authentication!!!
description The client must first authenticate itself with the proxy (Need authentication!!!).
Apache Tomcat/5.5.29