Introduction to Servlet technology
Chapters
HTTP status codes
Below are list of HTTP status codes and messages that are returned from Web Server:
Code |
Message |
Description |
100 |
Continue |
Only a part of request has been received by server. |
101 |
Switching Protocols |
The protocol server switch. |
200 |
OK |
Request OK |
201 |
Created |
Request Complete. |
202 |
Accepted |
Request accepted for processing. |
203 |
Non-authoritative Information |
|
204 |
No Content |
|
205 |
Reset Content |
|
206 |
Partial Content |
|
300 |
Multiple Choices |
A list of link |
301 |
Moved Permanently |
Page request moved to new url |
302 |
Found |
Page request moved temporarily to new url |
303 |
See Other |
Page request moved under a different url |
304 |
Not Modified |
|
305 |
Use Proxy |
|
306 |
Unused |
|
307 |
Temporary Redirect |
Page request moved temporarily to new url. |
400 |
Bad Request |
Request is not understand by server. |
401 |
Unauthorized |
Page requested need username and password |
402 |
Payment Required |
|
403 |
Forbidden |
Access is forbidden to requested page |
404 |
Not Found |
Server cannot find requested page. |
405 |
Method Not Allowed |
Method specified in request is not allowed. |
406 |
Not Acceptable |
|
407 |
Proxy Authentication Required |
|
408 |
Request Timeout |
The request took more time than Server was prepared to wait. |
409 |
Conflict |
The request cannot be completed due to conflict. |
410 |
Gone |
|
411 |
Length Required |
The "Content-Length" is not defined. |
412 |
Precondition Failed |
The precondition given in request evaluated to false by server. |
413 |
Request Entity Too Large |
The server will not accept request, Since request entity is too large. |
414 |
Request-url Too Long |
The server will not accept request, because url is too long. |
415 |
Unsupported Media Type |
The server will not accept request, because media type is not supported. |
417 |
Expectation Failed |
|
500 |
Internal Server Error |
unexpected condition from server |
501 |
Not Implemented |
|
502 |
Bad Gateway |
Invalid response received from the server. |
503 |
Service Unavailable |
Temporarily overloading or down of server |
504 |
Gateway Timeout |
The gateway timed out. |
505 |
HTTP Version Not Supported |
Methods to Set HTTP Status Code
Below are method used to set HTTP Status code in program.
Method & Description |
public void setStatus ( int statusCode ) An arbitrary status code is set in this method. |
public void sendRedirect(String url) The method generates a 302 response with a Location header |
public void sendError(int code, String message) The method sends a status code (usually 404) along with short message. |
In next part of this guide we will check our writing filters.
Description
This guide introduces Servlet technology and we will cover below topics
- What is a Servlet?
- Initial Setup
- Life Cycle
- Various Examples
- Client Request
- Server Response
- Http Status Codes
- Writing Filters
- Exception Handling
- Cookies Handling
- Session Tracking
- Database Access
- Packaging
- Internationalization
This is to the point introduction to the topic to get you started
Prerequisites
Working knowledge of Core Java is essential
Audience
Beginner to Java Servlet technology or students looking to brush up their skills quickly
Learning Objectives
Learn Java Servlets
Author: Subject Coach
Added on: 2nd May 2015
You must be logged in as Student to ask a Question.
None just yet!