• Enter your email address to subscribe to ROAblog and receive news and updates by email.

Spring, JavaMail, and URL-triggered Pages

I worked from my home today, in touch with Mr. Chandler via email and cell. Since Mr. Chandler had stayed up until approximately 12:20 the night before working on a junit test demonstrating the use of javaMail and Velocity template libraries, I was able to quickly wire up the account creation process to send a validation email to each new user with a unique link to activate their account. The reason we include the email confirmation step is to ensure that people use their own email addresses.

Our current model for automated emails triggered by user actions is to use Spring’s support for javaMail, in conjunction with Velocity. Our services must call Spring javaMail and set a number of straightforward properties for the email — such as from and to fields — passing in values to a Velocity template. Html templates of our own making will populate generic email forms with personalized data.

Later in the day I worked on wiring up a registrationFinalize.xhtml page. The link I mentioned earlier will contain the new user’s email address and a secure random confirmation code. Clicking the link will navigate to the finalization page, which contains a single output text field that calls a bean. Navigating to the page will trigger the bean constructor, which pulls the two arguments out of the url and calls the code to check this validation pair against those stored in our database system. If it finds it, it proceeds to validate the new account, and redirects to a login page.

Today’s note for dense summer interns: if you change the type of a property that will be persisted to the database after the table has been created, you must manually change the property type in the database. Hibernate doesn’t know how to handle being given a String and told to put it into an Integer property. I spent more than half an hour trying to figure out this error after I changed my UUID type on an object from int to String.

Today’s keyboard shortcut: Alt-Tab on Linux switches between windows. (all the computer savvy people out there are laughing at me for just now figuring this one out.) It’s so much faster than moving your mouse all the way to the bottom of the screen. Works like a charm on my Linux system, and google assures me it works for Windows too.