Java Enums, Web Servers, and Mock Objectsby chromatic
ONJava Newsletter for 04/24/2003
It's time yet again for another Java newsletter. It seems like just yesterday when the last one went out. If the days are running together for you too, step back, take a deep breath, and go for a nice walk. We'll be here when you get back.
For your reading pleasure, we present three articles this week:
If you've used other languages in the Algol family, you've probably come across enumerations as a fundamental data type. Lots of people lament Java's lack of enums--it's a popular feature request in the Bug Parade. Of course, like almost everything convenient, enumerations are just syntactic sugar and you can emulate them with existing constructs. John I. Moore, Jr., demonstrates the alternatives in Enums in Java (One More Time).
At its heart, HTTP is a pretty simple protocol. Open a socket, receive a connection, parse some headers, and send back other headers and some data. Web services, persistent connections, and virtual hosts get a little more complex, but serving files is easy. Popular author Budi Kurniawan explores Tomcat internals. In his Building a Java Web Server, he looks at exactly how to build a simple web server with Java.
To subscribe to the ONJava.com newsletter (or any O'Reilly Network newsletters), visit https://epoch.oreilly.com/account/default.orm and select the newsletters you wish to receive in your user profile (you'll need to log in with your existing O'Reilly Network account -- if you don't yet have an account, you'll need to create one).
To change your newsletter subscription options, please visit https://epoch.oreilly.com/account/default.orm and click the"Manage My Newsletters" link. For assistance, send help to
In the second excerpt from the new Java Extreme Programming Cookbook, Erik M. Burke and Brian M. Coyner demonstrate how to use mock objects effectively, first creating a mock event listener and next avoiding duplicate validation logic. Read more in Cooking with Java XP, Part 2.
Chris Adamson had a thought-provoking article this week. As you may remember, he's long considered the Java Media Framework rather useless, as Sun has gutted its support for interesting protocols. (Thank you, Fraunhofer.) His My Lost Streaming MP3 Article laments an open source project published just as Sun removed MP3 support from JMF. Ouch.
It's hard to fault Sun in this case. Licensing issues are nasty. Still, it's frustrating to write software that depends on a library that suddenly changes beneath you. Dramatic changes in core libraries and APIs can cause a lot of chaos. Before you reuse that software, it's worth asking, "Will this be around in the future?"
Until next week,
O'Reilly Network Technical Editor
ONJava.com News and Weblogs
Other O'Reilly Network sites
Return to list of ONJava Newsletters.
Return to the ONJava.com.