1. NADAR SARASWATHI COLLEGE OF ARTS AND SCIENCE
Name : P.Gayathri
Class : I M.Sc(CS)
Topic : HTTP Servlet,Server
2. HTTP Servlet
A servlet is a Java class that runs in a Java-enabled
server. An HTTP servlet is a special type of servlet that
handles an HTTP request and provides an HTTP
response, usually in the form of an HTML page.
The HttpServlet class extends the GenericServlet class
and implements Serializable interface. It provides http
specific methods such as doGet, doPost, doHead, doTrace
etc.
3. There are two main servlet types, generic and
HTTP:
Generic servlets: Extend javax. servlet.
GenericServlet. Are protocol independent.
HTTP servlets: Extend javax. servlet. HttpServlet.
Have built-in HTTP protocol support and are more
useful in a Sun Java System Web Server
environment.
4. Use of HTTP servlet request
Interface HttpServletRequest. Extends the ServletRequest interface
to provide request information for HTTP servlets. The servlet
container creates an HttpServletRequest object and passes it as an
argument to the servlet's service methods ( doGet , doPost , etc).
String identifier for Basic authentication.
5. Constructor of HttpServlet Class :
HttpServlet()
This is an abstract class so, the constructor does nothing.
6. Methods of HTTP Servlet:
doGet, if the servlet supports HTTP GET requests
doPost, for HTTP POST requests
doPut, for HTTP PUT requests
doDelete, for HTTP DELETE requests
init and destroy, to manage resources that are held for the life of the servlet
getServletInfo, which the servlet uses to provide information about itself
8. Server:
Server is a device or a computer program that accepts
and responds to the request made by other program,
known as client. It is used to manage the network
resources and for running the program or software that
provides services.
9. Server Class:
ServerSocket Class is used for providing system-
independent implementation of the server-side of a
client/server Socket Connection. The constructor for
ServerSocket throws an exception if it can't listen on the
specified port (for example, the port is already being used). It
is widely used so the applications of java.