Welcome Guest!
Create Account | Login
Locator+ Code:

Search:
FTPOnline
Channels Conferences Resources Hot Topics Partner Sites Magazines About FTP RSS 2.0 Feed

Free Subscription to Java Pro

email article
printer friendly

Install Jetty HTTP Server and Servlet Container
Use Jetty as a component to provide an HTTP server inside your Java apps.
by Budi Kurniawan

Posted December 10, 2002

Jetty—a free, open source tool written purely in Java—is both an HTTP server and a servlet container that conforms to the Servlet 2.3 specification. More important, you can use Jetty as a component to provide an HTTP server inside your Java applications. This article presents a general description of Jetty and shows you how to install and configure it.

ADVERTISEMENT

Jetty is a popular servlet reference implementation, included in many products such as JBoss J2EE application server, JOnAS EJB container, IBM Tivoli, SonicMQ, and Cisco's SESM. What's special about Jetty is that you can easily embed it as a component into your Java application and configure it both through XML files and coding. As of version 4.1, you can use Jetty in two different levels: as a core HTTP server and as a complete Jetty server.

As a core HTTP server, Jetty is able to serve static content and servlets. It is lightweight and embeddable, but still highly customizable. If used as a complete Jetty server, Jetty supports richer configuration capabilities through XML and the deployment of standard Web applications. At this moment, Jetty uses Tomcat's JSP parsing module, the Jasper JSP engine. As a result, you can also include JSP pages in your Web applications deployed in Jetty.

Figure 1. The Advanced Tab of the System Applet in the Control Panel

Jetty came into existence in 1995 when Greg Wilkins, founder of Mort Bay Consulting Australia, wrote it as an entry in the Sun Microsystems Australia Java programming competition. Greg won, and he continued developing it before making it an open source project in 1998.

To run Jetty, you must have JDK 1.2 or a later version installed. The first thing to do is download the distribution file (stable candidate) from http://jetty.mortbay.org. At the time of writing, the most recent version is 4.1.0. You can then extract the compressed file. For example, extracting to C:\ creates a C:\Jetty-4.1.0RC6 directory. This is called JETTY_HOME. Under JETTY_HOME are 16 subdirectories: bin, cgi-bin, contrib, demo, etc, ext, javadoc, launcher, lib, logs, src, src1.4, test, testdocs, webapps, and win32.

Under JETTY_HOME, you can also find the README.TXT file that offers instructions on how to install and start Jetty. There are three ways to install and run Jetty:

  • By using prepared scripts
  • By using the Ant build environment
  • Manually

Using prepared scripts is the quickest way to get Jetty up and running. If it does not work, however, you can always do it manually. The next section discusses how to install Jetty.



Back to top













Java Pro | Visual Studio Magazine | Windows Server System Magazine
.NET Magazine | Enterprise Architect | XML & Web Services Magazine
VSLive! | Thunder Lizard Events | Discussions | Newsletters | FTP Home