ตัวอย่างต่อไปนี้แสดงวิธีการส่งรหัสข้อผิดพลาด 407 ไปยังเบราว์เซอร์ไคลเอ็นต์ หลังจากนี้ เบราว์เซอร์จะแสดง "ต้องการการตรวจสอบสิทธิ์!!! " ข้อความ
<html>
<head>
<title>Setting HTTP Status Code</title>
</head>
<body>
<%
// Set error code and reason.
response.sendError(407, "Need authentication!!!" );
%>
</body>
</html> คุณจะได้รับผลลัพธ์ดังต่อไปนี้ -
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