0.4.4 release

3 views
Skip to first unread message

Julien Viet

unread,
Feb 13, 2012, 11:47:53 AM2/13/12
to ju...@googlegroups.com
Hi everyone,

I released 0.4.4 as I needed a few features to work. The main concern I tried to solve was to improve how a response is sent by a view or resource controller.

Previously it was only done via template rendering or via a of printer object obtained from the MimeContext. This was ok, but for some scenario not ideal, in particular with resource serving returning a non 200 ok response.

I got some inspiration from Play 2.0 way of doing things that I find very good and basically it is quite similar, some examples:

@Resource
public Response serve() {
return Response.notFound("<html><body>not found</body></html>");
}

It also works with injected templates:

@Inject @Path("error.gtmpl") Template error;
@Resource
public Response serve() {
return error.notFound();
}

Works also well in @View methods, where I think it opens new capabilities for unit testing:

@Inject @Path("users.gtmpl") users usersTemplate;
@View
public Response showUser(String userName) {
User user = ...
return usersTemplate.with().user(user).ok();
}

This is very useful because a unit test is able to analyse the parameter map containing the entry "user":user and assert the user is correct.

you can download it there : https://github.com/juzu/juzu/downloads

Julien

Reply all
Reply to author
Forward
0 new messages