Archive for October, 2010

REST with SpringMVC 3

Tuesday, October 19th, 2010

I know JavaEE is hot and Spring is Old-School! So, it’s the best time to talk about one component in SpringMVC 3 that I find quite nice & useful.

REST (REpresentational State Transfer) , as a Resource Oriented Architecture interested me specially for the URI functionalities. RESTful features in Spring MVC 3.0 are very convenient for that purpose.
You can manage your url directly within your controller. Thus, you can get as close as you want to your business terms within the url:


@Controller
public class ProjectController {
...
@RequestMapping("/{section}/{project}/index.html")
public String getProject(@PathVariable String section, @PathVariable String project, Model model) {
...
}
}

See also : rest-in-spring-3-mvc
See also RestTemplate : rest-in-spring-3-resttemplate

If you doubt GWT, check UIBinder

Tuesday, October 5th, 2010

If the GWT concept is nice, its use was frusterating : the code generated by the core framework was mostly composed of … Html Tables, which is just a headache to render properly. And most of all, what I did not appreciate with GWT was how people introduced it: “with GWT you don’t have to work with Html”. In my opinion, if your aim is not to deal with Html, then don’t work in web technologies. As a matter of fact, web is Html and Html5 is not Xml yet…

I talked about that with a friend of mine who is my GWT psychologist (thank you Nicolas!) . He told me to have a look to UIBinder, a framework integrated into the official GWT since 2.0.

What I find really exciting in that framework is the possibility to define exactly what you expect as rendering.

But UIBinder brings the real solution: add the component that you expect, add any Css styles you need and bind it to your data. That’s it! The View implementation is very easy and efficient: a template made in xml, a widget class that is bound to your different fields with annotation. You can have the benefit of the whole GWT Engine combined with the best use of the browser with Html and Css.

I hope the GWT Team will integrate that in their best practices, because for me it is the best way to work with the GWT client.