A Web server is a program that runs continuously while waiting
for and answering requests that it receives for Web pages
and for other resources and services. A Web server refers
primarily to a server that works with the Hypertext Transmission
Protocol (HTTP). It will recognize
the URL format in Web
page requests.
A Web server can also run external programs via CGI (Common
Gateway Interface) to process Web page form data or to carry
out other tasks. These could be C programs, Perl scripts,
etc.
Development of programs on the server side has become
one of the most successful commercial areas for Java. It is
used, for example, to create programs for database access,
for shopping cart systems at online stores, etc. The Java
2 Enterprise Edition (J2EE) offers many tools for building
server side software, or middleware as it is often
called.
However, with the basic resources available in java.net
in J2SE, you can also easily create small, specialized servers
for your own purposes. We show in this chapter how to create
a simple Web server using a socket
based approach. In the Chapter
15 we create both a server and a specialized client to
demonstrate how a client/server system could be used in a
technical application.
Such simple servers can be quite useful. For example, in
Chapter 24 we will show how to run a server in an embedded
processor. Such a server could provide information, for
example, about the state of a distant sensor or instrument.
In Chapters 16-20 we focus on RMI (Remote Method Invocation)
clients and servers and other distributed computing techniques.
In Chapter 21 we return to Web-based networking with a discussion
of Web services.
We briefly discuss servlets, which are special kind
of Java program run by a server, here
and in Chapter 21. Like
applets for browsers, servlets are specialized for running
with a server.