I have used happily Jersey/JAX-RS but I would suggest you Spring MVC 3, not only for the rest api support but also for other interesting stuff as IoC or beans that could turn out to be useful.
Here a link where to refer: http://blog.springsource.org/2009/03/08/rest-in-spring-3-mvc/
Btw, I've used Jackson with Spring as parser. :)
A bit of code (basically mark your bean, as you said, with @XmlRootElement and use @Path to mark the API)
JAX-RS
bean:
@XmlRootElement
public class Response {
private String result;
private String message;
//getter and setter
}
api:
@Path("rest/user")
@Produces(MediaType.APPLICATION_JSON)
public class UserService {
@POST
@Path("/login")
public Response login(
@FormParam("username") String username,
@FormParam("password") String password
) {
// Your logic here
}
}
Spring
api:
@Controller
@RequestMapping("/user")
public class UserService {
@RequestMapping(method = RequestMethod.POST, value="/login", headers="Accept=application/json")
public @ResponseBody Response login(
@RequestParam(value = "user", defaultValue = "") String email,
@RequestParam(value = "password", defaultValue = "") String password,
HttpServletRequest request
) {
// Your logic here
}
}