Friday, January 14, 2011

Characteristics of Servlets

Java servlets are fundamental Java EE platform components that provide a request/response interface for both Web requests and other requests such as XML messages or file transfer functions.

Servlets Use the Request/ResponseModel

Java servlets are a request/response mechanism: a programming construct designed to respond to
a particular request with a dynamic response generated by the servlet’s specific Java implementation. Servlets may be used for many types of request/response scenarios, but they are most often employed in the creation of HyperText Transfer Protocol (HTTP) responses in a web application. In this role, servlets replace other HTTP request/response mechanisms such as Common Gateway Interface (CGI) scripts.

The simple request/response model becomes a little more complex once you add chaining and filtering capabilities to the servlet specification. Servlets may now participate in the overall request/response scenario in additional ways, either by preprocessing the request and passing it on to another servlet to create the response or by postprocessing the response before returning it to the client. Later in this chapter, we discuss servlet filtering as a mechanism for adding auditing, logging, and debugging logic to your web application.

No comments:

Post a Comment