Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
6.3 A Front End to Various Search Engines
135
501 (Not Implemented)
The 501 (
SC_NOT_IMPLEMENTED
) status notifies the client that the
server doesn't support the functionality to fulfill the request. It is used,
for example, when the client issues a command like
PUT
that the server
doesn't support.
502 (Bad Gateway)
A value of 502 (
SC_BAD_GATEWAY
) is used by servers that act as proxies
or gateways; it indicates that the initial server got a bad response from
the remote server.
503 (Service Unavailable)
A status code of 503 (
SC_SERVICE_UNAVAILABLE
) signifies that the
server cannot respond because of maintenance or overloading. For
example, a servlet might return this header if some thread or database
connection pool is currently full. The server can supply a
Retry After
header to tell the client when to try again.
504 (Gateway Timeout)
A value of 504 (
SC_GATEWAY_TIMEOUT
) is used by servers that act as
proxies or gateways; it indicates that the initial server didn't get a timely
response from the remote server. This status code is new in HTTP 1.1.
505 (HTTP Version Not Supported)
The 505 (
SC_HTTP_VERSION_NOT_SUPPORTED
) code means that the
server doesn't support the version of HTTP named in the request line.
This status code is new in HTTP 1.1.
6.3 A Front End to Various Search
Engines
Listing 6.1 presents an example that makes use of the two most common sta
tus codes other than 200 (OK): 302 (Found) and 404 (Not Found). The 302
code is set by the shorthand
sendRedirect
method of
HttpServletRe
sponse
, and 404 is specified by
sendError
.
In this application, an HTML form (see Figure 6 1 and the source code in
Listing 6.3) first displays a page that lets the user choose a search string, the
number of results to show per page, and the search engine to use. When the
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
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