Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
128
Chapter 6 Generating the Server Response: HTTP Status Codes
204 (No Content)
A status code of 204 (
SC_NO_CONTENT
) stipulates that the browser 
should continue to display the previous document because no new doc 
ument is available. This behavior is useful if the user periodically 
reloads a page by pressing the  Reload  button, and you can determine 
that the previous page is already up to date. For example, a servlet 
might do something like this:
int pageVersion = 
Integer.parseInt(request.getParameter("pageVersion"));
if (pageVersion >= currentVersion) {
response.setStatus(response.SC_NO_CONTENT);
} else {
// Create regular page
}
However, this approach does not work for pages that are automatically 
reloaded via the 
Refresh
 response header or the equivalent 
HTTP EQUIV="Refresh" ...>
 HTML entry, since returning a 204 sta 
tus code stops future reloading. JavaScript based automatic reloading 
could still work in such a case, though. See the discussion of 
Refresh
 in 
Section 7.2 (HTTP 1.1 Response Headers and Their Meaning) for 
details.
205 (Reset Content)
A value of 205 (
SC_RESET_CONTENT
) means that there is no new docu 
ment, but the browser should reset the document view. This status 
code is used to force browsers to clear form fields. It is new in HTTP 
1.1. 
206 (Partial Content)
A status code of 206 (
SC_PARTIAL_CONTENT
) is sent when the server 
fulfills a partial request that includes a 
Range
 header. This value is new 
in HTTP 1.1. 
300 (Multiple Choices)
A value of 300 (
SC_MULTIPLE_CHOICES
) signifies that the requested 
document can be found several places, which will be listed in the 
returned document. If the server has a preferred choice, it should be 
listed in the 
Location
 response header. 
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