Jake Trent

Read Request Body in Spring Bean

Spring is a great addition to your Java stack. It helps you access the request for inside your Spring beans easily. Maybe I’m doing it wrong, but reading the request body seems blasted verbose after that. It takes a surprising amount of code.

Read more

'And' Spring @Secured Roles

Spring Security (previously Acegi) gives you an awesome AOP way of locking down methods in your Java application. And well-placed lock down is a special power indeed. However, Spring disappoints a bit on this score because it turns out its default behavior is to ‘or’ the roles listed in @Secured annotation. You’d think the default would be the stricter ‘and’, but alas. But never fear, there is hope.

Read more

Custom Exception Handling for AccessDeniedException

Our app throws all sorts of exceptions. Well, it doesn’t usually. It shouldn’t normally. Er… But, when it does we want to put in some handling so that the app doesn’t blow up in some unsuspecting user’s face. And even then, sometimes we want special handling for certain exceptions and make sure others are just caught. And that’s what we’ll do with AccessDeniedException.

Read more

Stored Procedures in Spring Jdbc

In addition to some sweet Inversion of Control injection action, Spring brings flowers and baby deer. And it brings some nice database connection help. Spring JdbcTemplate is a vanguard of strength and ease for connecting to your favorite RDBMS. And it so happens that the DBA I’m working with right now digs the stored procs. So, we’ll meet in the middle with some more goodness born of Spring.

Read more

Parameterized States in Webflow

My first experience with Spring Webflow is on a project that uses Webflow 1.0.5. So far, I’m impressed. Apparently, Webflow 2 offers even more incredible awesomeness, but thusfar I would put my webflow experience over that of my previous couple years in Seam. (I was just waiting for a chance to abandon that library anyway.)

Read more

Environment-based Dependency Injection

In developing an email notification system recently, we became interested in code acting differently depending on what environment we were in. A potentially good solution for this is environment-based dependency injection. This means that different Spring beans, for instance, will be used depending on the environment, ie dev, test, etc. This is useful for something like emailing, because we may not want real emails hitting the mail server in dev or test environments, but we do in prod. With some Spring constructs, it’s pretty easy.

Read more

JSF Modal Goodness

Meet the new web. The simpler the better. The cleaner the better. The more pleasing the colors the better. The fuzzier feelings the better. The latest fuzzies have been brought on by a slew of modals. Previously, we haven’t used many modals in our layouts and designs, so here’s the first working pattern on how to get this kind of stuff working.

This solution allows content to appear in a modal, validation errors to post back to the modal, edits made in a modal to persist back to the database, and success messages to appear on parent page.

Read more