views:

448

answers:

2

I'm developing a web application using Spring MVC 3.0 and looking for a ready-made solution, if any, or a "best practices" reference for a url/action mapping and routing system that can achieve the following:

  • REST-friendly controller / method name to view mapping. The current mapping implementation translates the request to a view name, which may be problematic when using several parameters and is incompatible with REST urls
  • A service that accepts the name of a controller, a method and arguments values and renders the URL that's represented by them
  • Integration with Spring Security that can allow me to check for a given URL whether the current user is allowed to access it, so that I can decide whether or not to render a URL
  • A menuing system based on the above that can define menues composed of these actions and render them to page

Basically what I need is the ability to define URLs in one centralized place, so that changing a URL (during development; I'm aware of the don't-change-live-urls idea :) ) does not mean looking up and changing that URL in a zillion pages.

Any directions to such an existing solution / tutorial / guide would be great.

Thanjs

A: 

Try using Spring Roo. It utilizes many best practices for spring MVC, and it has a scaffolding feature that automatically maintains a menu, jsp's and all the CRUD methods of a controller.

Setting up Spring Security with Roo is as simple as typing "security setup".

Hope this is helpful.

Matthew Sowders
A: 

This is a feature I really miss in Spring MVC. That's why I created the springmcv-router project, basically a port of PlayFramework's Router implementation in Spring MVC (HandlerMapping + HandlerAdapter).

It's brand new, but I'm heavily using it in a real-world project and the Router implementation itself is reliable.

Fixes, enhancements and documentation are on the way. The issue tracker is wide open :-D

Brian Clozel