Releases and Versions

By agreement with Sun Microsystems, the reference implementation for servlets and JSP is maintained by the Apache Software Foundation. The Apache web server is an open source project, and by far the most widely used web server in the world. You can look up more information about the Apache Software Foundation at www.apache.org. Apache uses the project name “Jakarta” for their Java-specific work.

The servlet library is part of the Enterprise Edition of Java, so must be downloaded separately if you are using the Standard Edition. The servlet design underwent some rapid evolution at first with a number of versions and releases, but it has settled down now. Table 26-1 and Table 26-2 spell out the details, so you can relate everything to other versions you may have heard about. At the time of this writing (2004), the most up-to-date version of the servlet API is version 2.4, and that is used in this chapter. Check the Apache website listed in Table 26-2 for any later version and download and use that in preference. This technology is mature enough that there shouldn't be any drastic changes in future revisions.

Table 26-1. Server/servlet versions

Date shipped

Servlet container version

Compatible with servlet version

Compatible with Java Server Pages version

2003

Tomcat 5

Servlet 2.4

JSP 2.0

Table 26-2. Glossary

Term

Definition

Apache

The Apache Software Foundation is a volunteer organization which has produced the most popular web server in the world, and made it available for free download. Their website is www.apache.org

Ant

A utility that accompanies Tomcat, used when Tomcat has to compile some servlet code automatically. Ant is a Java-based build utility that works out the correct dependency order in which to compile each file. It works cross-platform, unlike non-Java based tools. Ant is a replacement for “make” when used with Java.

Catalina

The servlet container (engine) part of Tomcat version 5.

CGI

The Common Gateway Interface was the first server-side scripting technology. It specifies how the server should execute a script when a particular web page is referenced. CGI scripts can be written in different languages, and Perl is a popular choice.

cookie

A cookie is a few bytes of information that the server asks the browser to store on the client, and return on demand. This token can be used to keep track of what pages the client has already seen, whether they have already given a password, and other information about the current session with the server.

HTTP

Hyper-Text Transfer Protocol. The vocabulary and standard way in which a browser and a server take turns to exchange information with each other.

Jakarta

The part of the Apache Software Foundation that focuses on Java server technology, and maintains the Java part of the Apache website. It has the Tomcat software as its centerpiece.

Jasper

The JSP server part of Tomcat.

JServ

An early implementation of the Java Servlet API from the Apache Software Foundation. It has been replaced by the Tomcat project.

JSP

Java Server Pages is a technology that allows programmers to mix together programming statements and HTML in web pages. The statements are executed and replaced with their output when the page is referenced. This server-side scripting approach was pioneered by Allaire's ColdFusion product on Windows.

Servlet

A servlet is any Java class that implements the javax.servlet.Servlet interface. It is executable by any compliant servlet container. The most common form of servlet is an HTTP servlet that responds to browser requests.

Tomcat

An open source servlet-and-JSP engine, written in Java, from the Jakarta project of Apache. Tomcat also includes a rudimentary web server, making it easy to use for development (you don't need to set up a separate web server).

POST

A request made by a browser that will upload user-entered data to the server and get back a new page. The contents of the new page will be calculated on the fly by the server. The client parameters (e.g. form data) are sent as a separate message.

GET

Similar to POST, except the browser or server may return a cached version of the page rather than calculating it anew. The client parameters (i.e. the form data) are appended onto the end of the URL.

The main product of Apache's Java-based Jakarta project is a servlet-and-JSP container known as Tomcat. Tomcat can run standalone as a servlet server, or it can be added on to most other web servers to process any Java requests. Tomcat was based on an earlier program known as “JServ” (in case you hear that term used somewhere). A “servlet container” is the new name for what older books refer to as a “servlet engine.” It simply means the software framework within which servlets execute. We will use Tomcat as the container throughout this chapter. Tomcat is used because it is the reference implementation for servlets, because it is available for free download, and because it is compatible with the most widely deployed web server in the world, Apache. Tomcat is written in Java, so you can get it running on any computer with an up-to-date JVM.

Theservlet and JSP specifications have changed and improved as people got practical experience with the technology. JSP 1.0 allowed the use of Java beans. JSP 1.1 added support for custom JSP tags. The Servlet specification 2.3 introduced filters that allow you to do preprocessing on an HTTP request before the servlet gets it. Servlets 2.4 had a host of small improvements and a couple of features deprecated or clarified. There are additional products that combine Java and web servers at the Apache website, and it is worth visiting jakarta.apache.org to review these for yourself.

Table 26-3 lists a glossary covering all the new terms, so you can refresh your memory or refer back to it as needed.

Table 26-3. HTTP headers

Header

Purpose

Content-Encoding

This header tells the browser that the content has been encoded for transmission, so the browser knows it has to change it back before displaying it. The content might be zip compressed, for example.

Content-/Language

This header specifies the language in which the content is written. The value is one of the language codes laid down by RFC 1766, e.g., “en” (English), “en-us” (North American dialect), etc.

Expires

This header specifies the time when the content is considered out of date, and hence should no longer be cached.

Connection

This header can have a value of “keep-alive” when persistent connections are being used, or “close” when they are not.

 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.140.195.225