Chapter 3: HTTP Servlets

 < Free Open Study > 



Overview

In the previous chapter we started to build our own servlets. Those servlets were extended directly from the superclass of all servlets, GenericServlet, and were not designed to handle requests made over a particular protocol.

However, in Chapter 1 we noted that the Hypertext Transfer Protocol (HTTP) is by far the most common protocol used to communicate with web applications. It should not therefore be surprising that HTTP forms the basis for most servlet communication too, and so as servlet developers we should make a special effort to understand both the protocol itself, and how to implement servlets that process requests made over it.

Therefore, in this chapter we are going to focus on HTTP and HTTP servlets. We will briefly discuss basic features of HTTP, including:

  • Methods

  • Headers

  • Status Codes

  • Authentication

Then we will move on to look at HTTP servlets. You will be introduced to the classes and interfaces of the javax.servlet.http package, which is used to implement HTTP servlets. We will implement a few simple HTTP servlets of our own too, and we will finish the chapter by implementing a more involved web application that demonstrates how to send and receive text files using an HTTP-based servlet and a Java client application.

Let's start simple though, and begin the chapter with a discussion of protocols used for communication between applications (including HTTP).



 < Free Open Study > 



Professional Java Servlets 2.3
Professional Java Servlets 2.3
ISBN: 186100561X
EAN: 2147483647
Year: 2006
Pages: 130

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net