Status Codes Classification in Web

Status Codes Classification in Web

After knowing clearly in a simple way "what a status code is?" and "why it is needed?", let us dig further in the subject.

A status code is a numeric value with 3 digits. W3C divided all the status codes broadly into 5 categories starting with digit 1 (of type 1xx), with digit 2 (of type 2xx), with digit 3 (of type 3xx), with digit 4 (of type 4xx) and with digit 5 (of type 5xx).

Status Codes Classification in Web

I. Status codes with Prefix 1 (of type 1xx) : Meant for just Information

This is not generally used but only for in experimental, testing, integration, deployment states. Here, the Testing engineer can send a message of information that the Servlet may be/may not be working with some extra information for team members.

Some examples:

"100" means "Continue" : Client can continue with his request. It is a message to client that the initial part of the request is honoured and second part of the request may be sent.

"101" means "Switching Protocols" : Information to the client that on the protocol the request is sent may be outdated version, the server is shifting the protocol a newer version for more advantages.

II. Status codes with Prefix 2 (of type 2xx) : Means that Web Server accepted the request successfully

It is not much used (because meant for positive response) and sometimes not visible to client.

Some examples:

"200" means "OK" : Request is successfully honoured.

"202" means "Accepted" : The request is accepted for processing but the processing has not been completed and may be disallowed.

III. Status codes with Prefix 3 (of type 3xx) : Meant for Redirection (Used when Server redirects the request)

The client requested the Web sever with some URL, but the server may shift to another URL to fulfil the request.

Some examples:

"301" means "Moved Permanently" : The client requested resource is permanently shifted to another new URL and future requests may be contacted on this new URL. The new URL is passed to client with Location header. The browser, if supports, can keep the new URL in cache.

"302" means "Found" or Moved temporarily : The requested resource is temporarily moved to some other location.

IV. Status codes with Prefix 4 (of type 4xx) : Client does some errors in requesting

Some examples on Status Codes Classification:

"400" means "Bad Request" : Request is not honoured by the server due to malformed URL syntax. The client can repeat the request with some modifications.

"401" means "Unauthorized" : Client is unauthorized for the request.

"404" means "Not Found" : Server is unable to find the resource to execute to fulfil the client request as client’s request does not match any suitable resource like Servlet/JSP.

V. Status codes with Prefix 5 (of type 5xx) : Resource is available on the server and server is able to locate it but still unable to exeucte it.

"500" means "Internal Server Error" : The server encountered a situation which prevented it from execution. For example, the client sends value ten in string form instead of numeric value 10. The server is unable to execute ten.

"505" means "HTTP Version Not Supported" : The HTTP version, client used to send the request, is not supported by the server.

2 more Postings exist on Status Codes Classification for your further reading.

1. What is Status code in HTTP Servlets?
2. List of Status codes – Commonly occurring

View All Servlets

Leave a Reply

Your email address will not be published. Required fields are marked *