HTTP 1.1 status code and its meaning

xiaoxiao2021-03-06  59

State code supported by HTTP 1.1 should be carefully used, because many browsers can only support HTTP 1.0. If you use the HTTP 1.1 unique state code, it is best to check the requesting HTTP version number (through the GetProtocol method of HttpservletRequest).

Status code status information meaning

100 Continue Initial request has been accepted, the customer should continue to send the rest of the request. (HTTP 1.1 new)

101 Switching Protocols Server Converses the request to the customer to another protocol (HTTP 1.1 new)

200 ok Everything is normal, the reply document requested for GET and POST is followed behind. If you don't have to set status code, the servlet uses the 202 status code by default.

The 201 CREATED server has created a document, and the Location header gives its URL.

202 ACCEPTED has been accepted, but the processing has not been completed.

203 Non-Authoritative Information The document has returned normally, but some responses may not be correct because the document is used (HTTP 1.1 new).

204 no content does not have a new document, the browser should continue to display the original document. If the user regularly refreshes the page, the servlet can determine that the user document is new enough, and this status code is useful.

205 Reset Content has no new content, but the browser should reset the content it displayed. Used to force the browser to clear the form input content (HTTP 1.1 new).

206 Partial Content The customer sent a GET request with the Range header, which completed it (HTTP 1.1 new).

300 MULTIPLE Choices Customer Requests Documents can be found at multiple locations, which have been listed within the returned document. If the server wants to make a priority, you should indicate at the Location response.

301 MOVED Permanently Customer Request Document In other places, the new URL is given in the location header, and the browser should automatically access the new URL.

302 FOUND is similar to 301, but the new URL should be considered a temporary alternative, not permanent. Note that the corresponding status information in HTTP1.0 is "Moved Temporatily", and the corresponding constant in httpservletResponse is SC_MOVED_TEMPORARILY instead of sc_found. When this status code appears, the browser automatically accesses the new URL, so it is a very useful status code. To do this, servlet provides a dedicated method, namely SendRedirect. It is better to use Response.sendredirect (URL) than using response.setstatus (response.sc_moved_temporarily) and response.setheader ("Location", URL). This is because:

First, the code is more concise.

Second, use SendRedirect, servlet automatically construct a page containing new links (for old browsers that cannot be redirected).

Finally, SendRedirect can handle relative URLs, automatically convert them into absolute URLs.

Note that this status code is sometimes used for replacement with 301. For example, if the browser is incorrectly requests http: // Host / ~ User (missing behind the late slash), some servers return 301, and some returns 302. Strictly speaking, we can only assume that the browser will automatically redirect when the original request is Get. See 307.

303 SEE Other is similar to 301/302, and the difference is that if the original request is POST, the redirect target document specified by the local header should be extracted (HTTP 1.1 new).

304 NOT MODIFIED The client has buffered documents and issues a conditional request (generally providing the IF-Modified-Since header indicating that the customer only updates the document updated than the specified date). The server tells customers that the original buffer document can also be used.

305 USE Proxy Customer Request documents should be extracted by the proxy server indicated by the Location header (HTTP 1.1 new).

307 Temporary Redirect and 302 (Found) are the same. Many browsers are incorrectly responding to the 302 response to redirect, even if the original request is POST, even if it actually only responds to the POST request is 303, it can be redirected. For this reason, HTTP 1.1 has increased by 307 to more clear the regional division of state code: When the 303 response occurs, the browser can follow the redirected GET and POST requests; if it is 307 response, the browser can only follow Redirection to the GET request.

Note that there is no corresponding constant for the status code in HTTPSERVLETRESPONSE. (HTTP 1.1 new)

400 Bad Request requests a syntax error.

401 Unauthorized Customers attempt to access the password-protected page without authorization. A WWW-Authenticate header will contain a www-authenticate header, the browser displays the user's name / password dialog, and then issues a request after filling the appropriate Authorization header.

403 Forbidden resource is not available. The server understands the customer's request, but refuses to handle it. It is usually caused due to the permissions settings of the file or directory on the server.

404 NOT FOUND Unable to find resources for the specified location. This is also a common response, HTTPSERVLETRESPONSE provides the corresponding method: Senderror (Message).

405 Method Not ALLOWED Request Method (GET, POST, HEAD, DELETE, PUT, TRAC, etc.) do not apply to the specified resource. (HTTP 1.1 new)

406 Not Acceptable The specified resource is already found, but its MIME type and customer are not compatible (HTTP 1.1 new) in the Accpet header.

407 Proxy Authentication Required Similar to 401, the customer must first authorize the proxy server. (HTTP 1.1 new)

408 Request Timeout In the wait time of the server license, customers have not issued any requests. Customers can repeat the same request later. (HTTP 1.1 new)

409 Conflict is usually related to the PUT request. Since the request and the current state of the resource conflict, the request cannot be successful. (HTTP 1.1 new)

410 Gone requested documents are no longer available, and the server does not know which address should be redirected. The difference between it and 404 is that the return 407 indicates that the document is permanently left the specified location, and 404 indicates that the document is not available for unknown reason. (HTTP 1.1 new) 411 Length Required server cannot handle the request unless the customer sends a Content-Length header. (HTTP 1.1 new)

412 Precondition Failed Request Some prerequisites fails (HTTP 1.1 new).

413 Request Entity Too Large The size of the target document exceeds the size of the server is currently willing to handle. If the server considers yourself to process the request later, you should provide a Retry -After header (HTTP 1.1 new).

414 Request Uri Too Long Uri is too long (HTTP 1.1 new).

416 Requested Range Not Satisfiable server does not satisfy the Range header specified in the request. (HTTP 1.1 new)

The 500 Internal Server Error server encountered unexpected situations and cannot complete the customer's request.

The 501 Not Implemented server does not support the functions required to implement the request. For example, the customer issued a PUT request that the server is not supported.

502 BAD GATEWAY Server As a gateway or agent, in order to complete the request to access the next server, the server returns an illegal response.

503 Service UNAVAILALALABLE server has failed to respond due to maintenance or load. For example, servlet may return 503 in the case where the database connection pool is full. A Retry -After header can be provided when the server returns 503.

504 GATEWAY TIMEOUT is used by a server as a proxy or gateway, indicating that you cannot get a response from the remote server in time. (HTTP 1.1 new)

505 HTTP Version Not Supported Server does not support the HTTP version indicated in the request. (HTTP 1.1 new

转载请注明原文地址:https://www.9cbs.com/read-113961.html

New Post(0)