BEA is hosting a free webinar entitled ‘Process Driven Development’ on Wednesday, April 7th. In this webinar, Garrett Conaty, Principal Technologist at BEA, will walk you through various technologies and best practices used to rapidly build Service Oriented Applications from requirements to implementation to production. He will start with business use cases and proceed to build a SOA implementation of these use cases by rapidly combining current technologies such as Web Apps, Web Services & Business Process Management, showing how they can be leveraged for service enablement and orchestration. Along the way you’ll get insight into some tips and tricks on leveraging this combination of existing technologies to jumpstart your own SOA projects.

Attendees will walk away best practices used to rapidly build Service Oriented Applications and tips and tricks for leveraging existing technologies to jumpstart your own SOA projects.

Date: Wednesday, April 7, 2004
Time: 9:00am PST / 12:00 Noon EST
Place: Your desktop
Registration: http://contact2.bea.com/bea/www/webinars/register.jsp?PC=W04-REF

Advertisements

I was just discussing this idea of Servlet Filters with a friend and I was trying to explain to him how Filters work and how they are really aspects in the AOP world. I think filters are really incredibly helpful and yet very few developers know about them and even fewer developers implement them. So my thought was that if we started using buzzwords like AOP around filters, suddenly Filters become sexy and everyone’s jumping over to implement Filters.

The filter API was introduced in the Servlet 2.3 specification and is defined by the Filter, FilterChain, and FilterConfig interfaces in the javax.servlet package. You define a filter by implementing the Filter interface. A filter chain, passed to a filter by the container, provides a mechanism for invoking a series of filters. A filter config contains initialization data. The most important method in the Filter interface is the doFilter() method, which is the heart of the filter. Filters intercept request to your web application based on the url-pattern specified in the web.xml, where the filters are defined.

I have used Filters extensively and have a few Filters ready to go when I am called into debug applications in production that are misbehaving or just broken. One of the filters I use quite often is a simple authentication filter that makes is easy to ensure consumers of the web application is authenticated. Here’s a simple snippet:

    /**
     * The <code>doFilter()</code> method performs the actual filtering work.  In its doFilter() method, each filter
     * receives the current request and response, as well as a FilterChain containing the filters that still must be
     * processed.
     * </p><p>
     * This filter is just used to capture and log information about the user being passed in to the login servlet
     * for tracking purposes.
     *
     * @param request Servlet request object
     * @param response Servlet response object
     * @param chain Filter chain
     * @exception IOException
     * @exception ServletException
     */
    public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
            throws IOException, ServletException {

        if (req != null) {
            HttpServletRequest request = (HttpServletRequest) req;
            //could pass in false in the getSession() to return null for new session.
            HttpSession mySession = request.getSession();
            String loginStatus = (String) mySession.getAttribute("LOGIN");

            if ((loginStatus != null) &amp;&amp; (loginStatus.equals(Boolean.TRUE.toString()))) {
                log.debug("FOUND A LOGGED IN USER - PASSING THRU");
                //Logged in - Let's pass thru the user
                chain.doFilter(req, res);
            } else {
                log.debug("FOUND A NEW USER - CHECKING STATUS");
                if ((request.getRequestURI().indexOf("login") != -1) ||
                        (request.getRequestURI().indexOf("index.jsp") != -1) ||
                        (request.getRequestURI().indexOf("images") != -1) ||
                        (request.getRequestURI().indexOf("ipo.css") != -1)) {
                    //User is going to or being redirected to login page or loading images - Let's pass thru the user
                    log.debug("NEW USER -&gt; LOADING CSS, IMAEGS or BEING REDIRECTED TO THE INDEX OR LOGIN PAGE");
                    log.debug("request.getRequestURI() = " + request.getRequestURI());
                    chain.doFilter(req, res);
                } else {
                    log.debug("NEW USER - LET's FORWARD TO THE INDEX JSP AGE");
                    log.debug("request.getRequestURI() = " + request.getRequestURI());
                    RequestDispatcher ds = ctx.getRequestDispatcher("/index.jsp?timeout=true");
                    ds.forward(request, res);
                }
            }
        }
    }

Here’s a copy of the original documented Filter java class.

I am a voracious book collector and (usually) reader as well. I love books and could spent hours reading – Just sad when life and work get in the way. ( Books I am currently reading include:

Need a few 3-day weekends to catch up and finish these books.

Java Examples in a Nutshell, 3rd Edition
by David Flanagan
Paperback: 720 pages
Publisher: O’Reilly & Associates; 3rd edition (January 1, 2004)
ISBN: 0596006209

In this 3rd edition, author David Flanagan has updated the book with coverage of Java 1.4. In keeping with the tradition of the other nutshell books, this book is an instant must-have book. This book is divided into 4 sections. The first section is a short yet very nice Java and OO tutorial. This book is not meant to replace your regular tutorial book, but can certainly act as that for someone who already knows the basics and is trying to bone up on the language API and usage.

The second section of the book covers the core Java API, including I/O, NIO, threads, networking, security and cryptography, serialization, and reflection. This section of the book is really solid and includes great working and commented examples of most of the core set of Java API. I really liked the network section as it includes code that will fulfill most of your needs in terms of network related development.

The third section of the book deals with graphics and user-interface including Swing, Java 2D graphics, preferences, printing, drag-and-drop, JavaBeans, applets, and sound. Not being much of a UI guy, I glossed over most of this section but it seemed complete and comprehensive. I know where I am going to turn if I ever need to work with Swing or applets.

The last section of the book includes coverage of the server-side Java or J2EE development, including JDBC, JAXP (XML parsing and transformation), Servlets 2.4, JSP 2.0, and RMI. Being a back-end or server side developer, I spent a lot of time consuming this section and I was very impressed with the quality of the coverage, explanation and examples included in this section. The section starts off with a nice introduction to JDBC, database metadata and includes some nice examples configurable example that are ready for use with little or no modifications. I think that’s important to new developers that are getting familiar with an API. In reading the code, it was nice to see the author using the execute() method instead of executeUpdate() or executeQuery() method along with a simple explanation of why he is doing that. Sounds simple, but I can’t tell you the number of times junior developers have come to me and asked me about this exact topic.

After JDBC, the book jumps into XML with a nice intro to SAX, DOM, and XSLT. Not a lot of meat here, but XML is always a moving target in terms of the API. I wish this section had a little more to it as it is missing the whole idea of Java-XML data binding which is a useful topic. After XML, the book moves over to Servlets and JSP. Nice intro to servlets and JSP, but leaves you wanting more. I think the whole server-side Java just needs to be another book and I think David should just come up with a Java Enterprise Examples in a nutshell. O’Reilly already has some great books in this category including the Java Servlet and JSP cookbook.

Having said all that, I still really like this book for how it deals with the core API. This book contains 193 complete, documented examples which makes it a must for any junior developer that knows or is learning Java and wants to know how to apply the API. The examples from this book are available for download from the author’s website located at davidflanagan.com.

The Milwaukee SPIN Group (Software Process Improvement Network) is having its meeting tonight (March 18, 2004) and the topic for tonight’s talk is ‘No Best Practices: Thinking about Methodology‘ by James Bach.

James Bach is a founding member of the Context-Driven School of Test Methodology and the author of Lessons Learned in Software Testing: A Context-Driven Approach.

The topic for the next Wisconsin Java Users Group meeting is Java Persistence Strategies with Bruce Tate. Bruce is the author of Bitter Java and Bitter EJB. More information about the meeting and location at http://www.wjug.org/wjug/nextmeeting.jsp. The meeting is on Tuesday, March 23rd, 2004.

I just read the story titled IPod Mini: Small Is Beautiful in Wired Magazine and I have to completely, wholeheartedly agree with the article. Talk about love at first sight. My friends Chris and Douglas each bought an iPod mini and the mere site of one will make you buy one. Be warned, it’s a hypnotic almost religious experience holding the mini in your hand for the first time. The minute I held the iPod mini in my hand, I knew I was going to buy one for myself. I already own the 30 GB regular iPod and I still couldn’t resist this one. Kudos to Apple engineers for designing a beautiful device that’s incredibly visually appealing as well as functional. The mini weights just 3.6 ounces and easily fits into any pocket.

The iPod mini looks just amazing in its anodized aluminum case that resists stains and scratches. The iPod mini holds 1000 songs or 4 GB of music and lasts up to 8 hours on a single battery charge. Unlike the bigger iPod, Apple has moved the iPod buttons under the scroll/click wheel which makes for a better user experience allowing you to scroll single-handedly though your music collection. Besides the smaller size and gorgeous form-factor, the mini has all of the same features of the regular iPod.

The mini ships with an AC adapter, traditional white headphones, FireWire and USB 2.0 cable and iTunes software for Windows and Mac. With iTunes, I am able to sync both my regular iPod and mini at the same time. A lot of people would urge you to spend $50.00 more and get the 15 GB iPod. I own both the iPod and now the mini and given the choice, I would trade in my regular iPod for my mini any day. Most of the iPod accessories including the iTrip work correctly with the mini. The only accessory that hasn’t worked yet is the Belkin iPod Voice recorder.

There are a lot of people that are writing reviews saying they would rather pay $50.00 more and the 15 GB iPod, but we are talking about apples and oranges. In fact, I completely agree with Chris’s blog entry about many of the iPod mini reviews. My only complaint about the whole package are the puny little earbud headphones that comes with the standard package. They are not bad, but they really don’t do justice to the great audio quality of the iPod. I am thinking about picking up a set of the Sony MDREX71SL Fontopia In-Ear portable headphones. After reading Chris and Cameron’s reviews, I am convinced. I love my Bose QuietComfort Acoustic Noise Cancelling headphones, but they are just too bulky for every day use. I love them for those long flights, but they are not for every day use.

If you are in the market for a great MP3 player, look no further. It holds over 70 hours of music, fits in your pocket and looks great doing it. I wish I could buy a few more of these little suckers for each day of the week. In fact, I really bought my mini for my wife. Just took me 2 days to make it mine!

BEA eWorld’s coming

March 11, 2004

BEA eWorld 2004 is coming up fast and I am still not registered for it. I’ve been to the last 3 out of the 4 eWorlds and I am pretty disappointed I am going to miss this one. As you probably know, BEA eWorld is in San Francisco at the Moscone Center, May 24-27. Tracks for this year’s eWorld include:

  • Business Processes and Integration
  • Performance and Manageability
  • Platform Productivity
  • Portal and Web Application Development
  • Practical SOA
  • Security
  • BEA WebLogic Server Nuts and Bolts
  • BEA WebLogic Solutions
  • Web Services and XML

The big focus of this conference is probably going to be Service-oriented Architecture (SOA) along with the WebLogic Workshop framework. It will be interesting to see if the whole Eclipse thing will get mentioned at all. I know there was some talk about IBM or the Eclipse group approaching BEA and asking them to use the Eclipse framework for its Workshop IDE. I know that would never happen, given the competitive nature of the relationship between IBM and BEA. I personally like the Workshop IDE and the idea of controls is neat for creating reusable components or wrapping services for corporate developers.

I am not sure if WebLogic 9.0 beta will be unveiled at this conference. SP2 for WebLogic server 8.1 just shipped and I’m sure the next release would be 8.5 instead and not 9.0. I’m really behind on my newsgroup reading and need to catch up to see what’s going on WLS land.

If you get a chance, sign up and go to eWorld as I always had a blast at this conference. The educational value is about a hundred times more than JavaOne and I would pick eWorld hands down if I had to choose between the two. The sessions are very technical and you really get to spend time with the real engineers behind the product. One of my favorite parts of last year’s conference was the TechTalk Night sessions where you could meet and hangout with other like-minded geeks. I remember sitting with Gordon Simpson, BEA’s Senior Director of Technology and polishing off 2 bottles of Beringer’s Cabarnet while discussing SOA. Good times!

I remember eWorld from 2001 where we had Zach (Stephan Zachwieja) cornered where we were grilling him about JMS in WebLogic 6.1. Zach couldn’t have been nicer and spent a ton of time with us. I also feel smarter every time I attend sessions hosted by or talk to people like Rob Woollen, Seth White, Gordon Simpson, Adam Bosworth, Cedric Beust and many of the other BEA geeks. It’s also interesting to find the Tangosol booth to hit up Cameron for one of the special ‘Fluster Clucked‘ t-shirts. I still have mine from last year.

BEA’s dev2dev has published a great article on thread dumps and tools for making the reading and parsing of them easier. For the uninitiated, thread dumps show the state of all threads at that point in time for any given process including a JVM. In UNIX, sending a process a -3 or -QUIT will generate the thread dump and send it out to system.out. On Windows, you can send a CTRL-BREAK in the DOS Window to generate the thread dump. Thread dumps are really helpful in debugging issues with your application, especially with deadlock issues.

In my blog entry entitled My Love Affair with JRockit, I showed how JRockit has the facility built into it to generate thread-dumps for any running JRockit VM.

In this dev2dev article, the author discusses the idea of taking the hard-to-read thread dumps and then converting them to XML to add some structure. Once the thread-dumps are converted to XML, you can apply a XSL stylesheet to format the XML document into something more readable and meaningful. In the article, the author converts a XML thread-dump into an HTML document and an image (700k). Great read and a great idea.

In the great tradition of cookbooks, O’Reilly has published the Java Servlet and JSP Cookbook. This book, written by Bruce W. Perry is a must-own book for anyone working with web applications in the Java space. I’ve been a Java developer for almost 8 years now and have been working with Servlets since early 1999 and I’ve learned quite a few things from this book.

Java Servlet & JSP Cookbook
By Bruce W. Perry
Paperback: 704 pages
Publisher: O’Reilly & Associates; 1st Edition edition (December 1, 2003)
ISBN: 0596005725

The Java Servlet & JSP Cookbook provides more than 200 ‘recipes’ or fully working and documented code snippets that you can directly cut-and-paste in your application. The book starts off with a quick intro to writing servlets and JSP pages. I was very impressed that the first JSP page that you write uses JSTL and is not loaded up with scriptlet code. I am just sick and tired of arguing with people with scriptlets are bad and it’s nice to see a book that starts off with JSTL. Kudos Bruce.

Once the intro is complete, you move onto writing deployment descriptors, deployment and then move on to Ant. One of the most common question people ask after deploying JSP based application is the idea of precompiling JSPs for performance reasons. The fifth chapter does a great job of suggesting several methods of precompiling JSPs. I should also mention that the book includes how-to guides for Tomcat and WebLogic, which covers a pretty large landscape of web containers. WebSphere, Resin, Jetty are not directly covered but who uses anything but WebLogic, right? 🙂

The book then moves on and covers topics such as handling Form data via POST/GET, uploading files, cookies, session tracking and URL rewriting. There is also a chapter on JavaScript and how they use JavaScript with servlets. I don’t really understand the point of this chapter as most users just need a few cut-n-paste JavaScript for client-side FORM validation. There is also a chapter on streaming non-HTML content such as PDF, audio/video files and others to the browser.

I also liked the chapter of logging in Servlets and JSPs. This chapter includes a nice introduction to Log4j and a nice tag library that uses Log4j under the cover. My favorite chapter in this book was the chapter dealing with authentication. The chapter starts off by talking setting users in Tomcat and then moves into setting up BASIC authentication. The next recipe talks about using Form-based authentication. The chapter is rounded off with a good treatment of the Java Authentication and Authorization service (JAAS). In this chapter, you create your own custom LoginModule and then use JAAS in a servlet and JSP.

There is also a chapter about embedding multimedia content inside JSPs. This is not something I’m really interested in and I just glossed over this chapter. The same goes for the next chapter on manipulation of the HttpRequest. The next chapter does a great job of exploring Servlet Filters, which is a great feature introduced in the Servlet 2.3 specification that hasn’t really caught on. Filters are great and the book includes some great examples of how best to use them.

The next section includes chapters on sending, accessing email from servlets along with database access. Most complex application usually will implement some backend service to access database and separate the business logic from the data and the data from the UI, but the included recipes will help get you up and running for simple application.

I really liked the section on custom tag libraries and JSTL. Tag Libraries are a great way to avoid scriptlet code in JSPs. The chapter on JSTL is also fairly comprehensive and includes code snippets for the core, XML, format, and SQL tags. There is also a great section on the Expression Language (EL) which has been migrated from JSTL 1.0 to the JSP 2.0 specification.

I could go on about this book but I won’t bore you any longer, assuming you are still reading. I highly recommend this book for anyone doing any type of Web development using Servlet and JSPs. I mentioned this earlier, but I’ve been writing Servlets and JSPs for the past 5 years and I’ve learned quite a few things from this book. Add this book to your library today. The code for this book is available on O’Reilly.com

I want one, now! My friends Chris and Douglas went out this past weekend and each picked up new iPod Minis. I got a chance to play with Douglas’s mini today and I just feel in love. I already own a 30GB iPod and I want one of these Mini’s now. I fell in love, there’s no other way to describe the feeling of holding this sleek and cute little device in your hands. Apple just has an amazing eye for style in everything they do and they make just amazing looking, functional products. My iPod was the first Apple product I purchased and I was so impressed with the box the iPod came in, let alone the device. Chris always rails on the PC manufactures for the lack of imagination and I have to totally agree. Sony and Toshiba have some neat PC/laptops, but the rest of the herd seems to make the most generic, boxy unattractive machines. Now I just have to figure out how to buy a mini without my wife yelling at me.

Update: Just saw this on MacMinute via. Erik’s blog. Merrill Lynch analyst Steven Milunovich said that revenue from iPods should be around US$1 billion this year. That number is estimated to double to $2 billon by 2006

[OT] Pepsi & iTunes

March 1, 2004

The Pepsi/iTunes promotion is a great idea and it’s got me hooked. I had given up drinking any kind of soda in lieu of water years ago. But the Pepsi/iTunes promotion has me hooked – I am now going out of my way to buy Diet Pepsi’s to win the free songs on iTunes. So far, I’ve gotten 10 out 11 winners using the MacMerc method of spotting a winner. I’ve gotten quite a few weird looks at the store for going through bottles of Pepsi looking for winners.

[OT] Pepsi & iTunes

March 1, 2004

The Pepsi/iTunes promotion is a great idea and it’s got me hooked. I had given up drinking any kind of soda in lieu of water years ago. But the Pepsi/iTunes promotion has me hooked – I am now going out of my way to buy Diet Pepsi’s to win the free songs on iTunes. So far, I’ve gotten 10 out 11 winners using the MacMerc method of spotting a winner. I’ve gotten quite a few weird looks at the store for going through bottles of Pepsi looking for winners.