Graphic HTTP reading notes-(four HTTP status codes that return results)

Source: Internet
Author: User
Tags error status code
Four HTTP status code to return results 4.1 Status code tells the result of requests returned from the server side

Code category Reason phrase

100-199 Information The status code is used to specify certain actions that the client should have accordingly.
The 200-299 Success status code is used to indicate that the request was successful.
300-399 REDIRECT status codes are used for files that have been moved and are often included in the locator header information to specify new address information.
400-499 Client error status codes are used to indicate client-side errors.
500-599 Server Error status code is used to support server errors.

There are a lot of status codes, listing some common

4.2 (ok/Normal)
(SC_OK) means everything is normal. Typically used for corresponding get and post requests. This status code is default to the servlet, and if you do not call the SetStatus method, you will get 200.

204 (no content/no content)
The request received by the server has been processed successfully, but the body of the entity is not included in the returned response message. Typically, 204 (sc_no_content) ensures that the browser continues to display the previous document without a new document. These status codes are useful for users to reload a page periodically, and you can determine if the previous page has been updated.

206 (partial content/local content)

206 (sc_partial_content) is sent when the server completes a partial request that contains the range header information.  The response message contains the entity content with the specified range of Content-range, which is newly added in HTTP 1.1. 3XX Redirection:

Indicates that the browser needs to perform some special processing of the correct request.

301 (Moved permanently)
Permanent redirection, 301 (sc_moved_permanently) state refers to the requested document elsewhere; The new URL of the document is given in the location response header information. The browser will automatically connect to the new URL.

302 (found/found)
Temporary redirection, similar to 301, is simply that the URL given in the locator header information should be interpreted as a temporary interchange address instead of being permanent. The constant representing status code 302 is sc_moved_temporarily instead of Sc_found.

303 (see other/for additional information)

This status code is similar to 302, except that if the initial request is POST, the new document (given in the locator header information) is retrieved using GET. This status code is newly added to HTTP 1.1.

304 (not modified/for remediation)
When a client sends a request with a condition (the following example), the server allows the request to access the resource, but the condition is met. Such as:

When a client has a cached document, it is possible to make a conditional request by providing a If-modified-since header information that indicates that the client only wants the document to be modified after the specified date to be overloaded. 304 (sc_not_modified) means that the buffered version has been updated and the client should refresh the document. Additionally, the server returns the requested document and status Code 200. The servlet generally does not set this status code directly. They implement the Getlastmodified method and let the default service method handle conditional requests based on the remediation date. The routines for this method are given in 2.8 parts (an Example using servlet initialization and page modification dates/A example using servlet initialization and page correction date).

305 (Use proxy/using proxy)
305 (Sc_use_proxy) indicates that the requested document is to be obtained through the proxy server in the location header information. This status code is newly added to HTTP 1.1.

307 (Temporary redirect/temporary redirect)
307 The rule of the state is the same as 302. However, because many browsers do not adhere to the rules, when the 302 response is received, even if the original message is post, the post will be changed to get and delete the body of the request message. It is only assumed that the browser will redirect at the post request only when the 303 response is received.

307 This status code is newly added to HTTP 1.1. The purpose of adding this new status code is clear: it does not change from post to get. 4.4 4XX Client Error

(sc_bad_request)

Indicates a syntax error in the client request.

401 (unauthorized/not authorized)
401 (sc_unauthorized) indicates that the client accesses a password-protected page when there is no valid identity information in the authorization header information. If 1 requests have been made before, the user authentication fails.

The response must contain a Www-authenticate authorization header to challenge the user's information, and the browser will pop up the authentication dialog box when it first receives a 401 response.

403 (forbidden/Forbidden)
403 (Sc_forbidden) means that access to the requested resource is rejected by the server, and the server does not need to give a specific reason. Typically, the file system is not authorized for access, or is caused by a corrupted file or directory license on the server.

404 (Not found/found)

Indicates that the server was unable to find the requested resource and that most people would encounter this error. 4.5 5XX Server-side error

Indicates an error occurred on the server itself.

502 (Bad gateway/wrong gateway)
502 (Sc_bad_gateway) is used to act as a proxy or gateway server, which indicates that the receiving server received an error response from the remote server.

503 (Service unavailable/services not available)
The Status Code 503 (sc_service_unavailable) indicates that the server is unable to respond because it is maintained or overloaded. For example, if some threads or database connection pools are not already idle, the servlet returns this header information. The server can provide a Retry-after header information to tell the client when it can try again.

504 (Gateway timeout/gateways Timeout)
This state is also used to serve as a proxy or gateway server, which indicates that the receiving server has not received a timely response from the remote server. The status is newly added to HTTP 1.1.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.