Gary said:
Hi, I thought I new lots about java programming but I dontthink I do
now. I have just been on a cramming course and we were using Tomcat
for our servlets. Someone said they had used that "application server"
before and the tutor said no, "it wasn't an application server, it was
a servlet container". So what is the differerence and when would you
use the later over the former.
An application is a server for applications- a client communicates with
it to invoke a process on a remote machine. Application servers may be
built on many technologies, including servlets. Historically, and the
largest deployed base, application servers make their connection through
telnet and the communication is plain text. Richer application server
technologies includes the X server system, which allows full interaction
with a wimp GUI application over a network. Other application serving
technologies are based on RPC, ASN.1 and CORBA, in which effieint binary
message take the place of the text-based messages used in web applications.
A web application server is an application server that uses http as its
communication protocol. Layered on top of the http may be plain text,
mime, XML RPC or any other message format - including RPC and CORBA if
you're so inclined. Web application severs are popular because it is
possible to access them with a commonly available client that provides
simple form and text UI (unlike X where to program the application
require more knowledge of a full windowing system library, or telnet
where the client is text only) and the protocol is easy to implement
(you only have to read a socket an parse one line of text). For
anything more complicated, eg 3D rendering or fuller GUIs like Java web
launch or XUL, the web application server paradigm generally pushes the
processing back to the client, so you end up with only half teh
application server side.
A servlet container is built into a web application server to enable it
to run application engines based on the Java servlet technology. Through
it the servlet handle requests that are passed to it via a standard
interface, without the application layer having to manage load balancing
and (to an extent) other resource management.
A J2EE web application server implements an interface giving additional
functionality for enterprise applications.
Tomcat is a web application server, which either contains or is a
servlet container, depending on the version (version 4.0 the container
has a seperate identity and is called Catalina, versions 3.0 and 5.0
doen't make this distinction). It is not a J2EE web application server.
As to which technology you use to implement your application server,
that depends on many factors. If the interface is to a human via simple
text and forms, you might send html and recieve mime over http, and use
a web server. Applications with more complexity require fatter clients,
so the server stops being an application server and takes more of a
mediation role for sharing common resources between applications than
are running on the client. The technology implementing the application
in the server has no bearing on whether the server is an application
server or not-if you have specified your interfaces and protocols
sensibly, you should be able to replace a GCI based server with a J2EE
one without the client requiring any change, or any change in the
functionality of the application.
Some web application servers use CGI. Some use JSP, PHP and ASP. If the
application lends itself to being implemented on the JVM, you can use
servlets. If you wish to manage state automatically and connect to
databases, then J2EE may help with that functionality, and impose an
component architecture that is intended to help reuse.
Pete