A provocative email appeared in my inbox from the Webmonkeys a couple of weeks ago. It said, "We're doing an article on why Linux/Apache makes the best Web-serving platform. Do any of the NT users in the HotBot quad want to defend the folks in Redmond?"
I'm an old Apple guy seven-and-a-half years in the mid-'80s and early '90s so I had half a mind to ignore my co-workers down the hall. But I am using Microsoft's Java development environment on a daily basis, and I do like a challenge, so I responded, "I don't know if I want to defend Microsoft, but it does have some nice tools for doing Web-application development. Do you want a demo?"
That's how I've come to tell you how to use Java to extend Microsoft's IIS (Internet information server) Web server.
If you don't know already, IIS comes bundled with NT Server 4.0. From a Web-site-development standpoint, the coolest feature is probably active server pages, more commonly known as ASP, which makes it easy to create dynamic Web sites. Using ASP, you can gather information sent with an HTTP request; respond to the user's browser (e.g., deliver different Web pages to new and old browsers); and store information about particular users (such as user-selected preferences, so you can deliver customized experiences). ASP also ships with a set of extensions that allows you to do things like connect to databases, perform ad and content rotation, determine browser capabilities, read and write files, and insert page counters.
But what happens when you need functionality that is not included with IIS and ASP? Why, you write an IIS server extension, of course.
There are two reasons you might want to create a server extension: functionality and performance. Regarding performance, because ASP is so easy to use, you may find yourself overusing it. ASPs use interpreted languages and, while they're pretty zippy, they can't compete for pure processing speed with languages like C/C++ or Java. We were using ASP heavily on HotBot, and we were starting to see some server performance problems. A code review revealed that we were overusing ASP for certain functions, particularly for file I/O (input-output). We changed a couple of functions and saw an immediate 50 percent increase in pages served per second. As a result of this improvement, we are in the process of moving many of our other ASP functions into C++ and Java. I predict we'll see more significant speed improvements by the time we're done. When it comes to functionality, ASP (along with VBscript or Jscript) provides a fairly complete programming environment, and the server extensions that ship with IIS are useful. But they may not solve your particular problem.
You may need to connect your Web site to a legacy database. Or you may need to perform file I/O that is beyond the capability of the FileSystemObject that ships with IIS. Or you may want to connect to another information source across the Internet and put that information into one of your Web pages. Sooner or later, you'll come up against a task that will require you to write an IIS server extension to get the job done.
next page»