Welcome

Mojo
Posts about photography, contract bridge, astrophotography, astronomy, Java development, internet systems.

“Building Next-Generation Web Applications with the Spring 3.0 Web Stack” Jeremy Grelle

Notes from TheServerSide Java Symposium March 2009

Jeremy is going to help us battle complexity in web applications. (It’s hard to find a web framework that isn’t its own layers of complexity.) He’s the lead for Spring Faces, Spring JavaScript, and a JSF 2.0 expert group member, and he’s a former “rock star.”

The Spring Web stack is a collection of open source projects that provide infrastructure for developing and running Java web applications. You can pick and choose the pieces you need, and it works on any server platform.

Spring Framework and Spring MVC are the common foundation. On top are Spring Web Flow, Spring JavaScript(!), Spring Security (formerly Acegi), and on top of that, Spring Faces (JSF integration support) and Spring BlazeDS Integration (brand new, integrates Flex clients with the back end).

Here are some new features being introduced with Spring 3.0.

Spring Framework and Spring MVC

The new support that I really like is a URL paradigm that acts more like RESTful web services. URLs become meaningful, and identify a heirarchy right into your domain model.

URL examples:

  • /hotels would render a list of al hotels
  • /hotels/westindiplomat would give hotel details
  • /hotels/westindiplomat/bookings a list of bookings
  • /hotels/westindiplomat/bookings/4325324 a specific booking.

Query variables become less significant, and primarily input for algorithms. They tend to get ignored by proxies, and often abused.

The key to these RESTful URLs are URI Templates containing variable names, for example /hotels/{hotelId}. Supported in Spring 3.0 with the @PathVariable annotation, which allows you to use URI templates in MVC.

This is really nice! Controlling URLs nicely is a frequent complaint of mine in typical Java servlet frameworks. Adopting RESTful URL patterns is friendly, readable, and makes a lot of sense. Cut down the use of parameter variables, and put the domain IDs right into the URL path.

He also showed new view features for content negotiation, new views like and RssFeedView, and ways to support all four standard HTTP verbs from the client (PUT and DELETE as well as GET and POST). (Now you can use <spring:form method=”delete”/> for instance.)

Spring JavaScript

Spring’s Ajax integration library, builds upon the Dojo toolkit. The “key value proposition” builds in usage best practice, makes Dojo easy to use for common Ajax scenarios. (I thought Dojo was already pretty easy to use. Do we need another layer of abstraction?)

Spring Web Flow

Web flow is primarily a framework for implementing user dialogs, guiding a user through a business process. Things that  are session-related and stateful. Key feature is a high-level flow definition language using XML and EL. Plugs into Spring MVC. (Not sure I see the value here yet.)

Spring BlazeDS Integration

Newest project being introduced with 3.0. Connects Flex client to Spring-managed services using BlazeDS transports. They claim it makes Flex natural in a Spring environment. Integrates Spring Security to secure Flex apps. Provides support for real-time data push using Spring Integration.

Examples

He started walking through a new-style @Controller object with the @RequestMapping annotation marking one of their flexible controller methods. The <form> tags in his view are making use of the newly visible http verbs, like DELETE to remove a hotel booking.

Demonstrated some of the Ajax features of the Spring Javascript library. Uses the tiles API to only render the part of the page requested.

The walkthrough of the actual @Controller code with support for new features looked clean, incremental, and going in just the right direction incrementally.

So are we just adding complexity, or making anything simpler and easier? I don’t think I’ll know until I try it out.

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>