Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
132
Chapter 6 Generating the Server Response: HTTP Status Codes
404 (Not Found)
The infamous 404 (
SC_NOT_FOUND
) status tells the client that no 
resource could be found at that address. This value is the standard  no 
such page  response. It is such a common and useful response that 
there is a special method for it in the 
HttpServletResponse
 class: 
sendError("message")
. The advantage of 
sendError
 over 
setSta 
tus
 is that, with 
sendError
, the server automatically generates an error 
page showing the error message. Unfortunately, however, the default 
behavior of Internet Explorer 5 is to ignore the error page you send 
back and displays its own, even though doing so contradicts the HTTP 
specification. To turn off this setting, go to the Tools menu, select Inter 
net Options, choose the Advanced tab, and make sure  Show friendly 
HTTP error messages  box is not checked. Unfortunately, however, few 
users are aware of this setting, so this  feature  prevents most users of 
Internet Explorer version 5 from seeing any informative messages you 
return. Other major browsers and version 4 of Internet Explorer prop 
erly display server generated error pages. See Figures 6 3 and 6 4 for 
an example.
Core Warning
By default, Internet Explorer version 5 ignores server generated error pages.
405 (Method Not Allowed)
A 405 (
SC_METHOD_NOT_ALLOWED
) value indicates that the request 
method (
GET
, 
POST
, 
HEAD
, 
PUT
, 
DELETE
, etc.) was not allowed for this 
particular resource. This status code is new in HTTP 1.1. 
406 (Not Acceptable)
A value of 406 (
SC_NOT_ACCEPTABLE
) signifies that the requested 
resource has a MIME type incompatible with the types specified 
by the client in its 
Accept
 header. See Table 7.1 in Section 7.2 
(HTTP 1.1 Response Headers and Their Meaning) for the names 
and meanings of the common MIME types. The 406 value is new in 
HTTP 1.1. 
Second edition of this book: www.coreservlets.com; Sequel: www.moreservlets.com.
Servlet and JSP training courses by book's author: courses.coreservlets.com.






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

jsp web hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Jsp Web Hosting Cheapest Web Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved