Wednesday, 22 February 2006

Servlet Specification

Okay, I should read the specification. I will read the specification. Please don't remind me. :)

The HFS&JSP chapter exams answer keys have sidebar scribbles noting the page of the Servlet spec applicable. Very helpful.

The spec has been very enlightening the few times I've actually looked at it before. Not to dry, but to the point.

Posted by caffeinated at 9:49 PM in SCWCD

Monday, 20 February 2006

Head First deployment

One aspect of studying for the SCWCD exam with Head First is how it subtly drills webapp deployment into your head.

While it might be tempting to just start automating it in an IDE, like NetBeans, the command line compiling, directory layout, Tomcat pushes, restarts, etc. have the added benefit of getting the reader to understand how it all is suppose to work.

I love it. Have I mentioned that I'm a geek?

Posted by caffeinated at 10:59 PM in SCWCD

When to set response headers...

The simple answer is: ...always before you flush your response to the client.

In studying for the SCWCD exam I was left with the impression that if you attempted to play with the response after it was committed, a java.lang.IllegalStateException would be thrown.

No! Do not let this trip you up on the exam.

For instance, below is some code I came across that had me saying "Whoa! this is going to throw an IllegalStateException. Danger Will Robinson!"

  ServletOutputStream out = response.getOutputStream();

  // set headers

So as it turns out nothing was happening. I thought that the ISE was being skirted because headers are buffered and the default buffer size was just large enough...but it was a poster on JavaRanch that clued me in.

The Servlet specification answers the question quite clearly: headers set after the response is committed (javax.servlet.ServletResponse#isCommitted()) are simply ignored. (see SRV 5.2)

Posted by caffeinated at 7:14 PM in SCWCD

Monday, 6 February 2006

HttpServlet API

Well, for the last several days I have been following the guidance of “meta-cognition” and really reading what there is to know about the request and response model of the Servlet API for the SCWCD exam. About 5–6 pages a day with some review.

Aside from some vocabulary expansion I closed the chapter with the mock exam, learning that I need to study the Servlet API/class diagrams/inheritance much more before taking the real exam.

And commit it to memory! I missed some obvious questions (without looking back at the material of course) solely because I didn't study the class diagrams more closely in the book.

Your word of the day: idempotence.

Posted by caffeinated at 10:18 PM in SCWCD

Wednesday, 1 February 2006

Dreaming in code

Three days of studying for the SCWCD exam and I’m already dreaming in code.

The conventional wisdom is that when you begin to “dream in x” (whatever x might be), you have achieved some foundation of understanding in x.

Maybe the last three days have been all review for me around HTTP, Servlet containers, Apache, Tomcat, deployment descriptors, etc., but I look at this nocturnal development as a good thing. Have I told you that I’m a geek?

Posted by caffeinated at 8:43 AM in SCWCD

Monday, 30 January 2006

Day 2

I don’t anticipate that I’ll knock out a chapter a day studying for the SCWCD exam, but the first two chapters of Head First Servlets & JSP have been good, solid, review of stuff I know pretty well.

I found myself breezing through the code magnet puzzle writing a simple servlet and associated web.xml.

The puzzles and sidebars through out the chapter (and even the graphics) have been really good cues for reinforcing the material and make the book fun to read. I find myself scribbling a note or a “supplemental” bad joke in the margins. All part of meta-cognition.

Okay, I’m starting to sound like a HF fan-boy…but have you seen this series? I’m genuinely impressed.

Posted by caffeinated at 10:28 PM in SCWCD

Sunday, 29 January 2006

The Journey Begins

I picked up Head First Servlets & JSP. Great book! I love the irreverant writing and the learning philosophy, meta-cognition.

Lots of questions. A mock exam. Puzzles. Sidebars. Thinking games. Satire. Pro UNIX/BSD. Tomcat.

Chapter 1 is a solid review of HTTP and HTML. There is a good introduction to Tomcat deployment actually in this first chapter, just to satisfy the impatient. Nothing I’m not already familiar with actually, but a good review of the foundations of what makes it all work while introducting Objective 1.1 of the SCWCD exam.

The authors love one thing: beer. And maybe one other, I’ll let you work out this puzzle: what’s with all the 4:20 references, there’s even a 24 hour clock 4:20 reference (16:20:01)! Too many happy coders on the slopes out there in CO? I think! :)

Posted by caffeinated at 10:19 PM in SCWCD