Skip to content

Instantly share code, notes, and snippets.

@guilhermesilveira
Created October 17, 2010 20:55
Show Gist options
  • Select an option

  • Save guilhermesilveira/631279 to your computer and use it in GitHub Desktop.

Select an option

Save guilhermesilveira/631279 to your computer and use it in GitHub Desktop.
public class Basket implements HypermediaResource {
public void configureRelations(RelationBuilder builder) {
builder.relation("self").uses(BasketsController.class).show(id);
builder.relation("payment").uses(PaymentsController.class).create(id, null);
}
}
@Get
@Path("/items")
public void list() {
resource = restfulie.enhance(database.lista());
resource.relation("basket").uses(BasketsController.class)
.create(null);
result.use(representation()).from(resource, "items").serialize();
}
@Resource
public class SoftwareController {
@Get @Path("/software/{id}")
public Software show(long id) {
Software retrieved = dao.search(id);
return retrieved;
}
}
<html>
My ${software.name} page
</html>
@MatrixFrog

Copy link
Copy Markdown

This is used on the English-language page http://www.caelumobjects.com/2010/10/18/jax-rs-2-0-how-to-improve-it/ but the second example has database.lista() which I supposed was meant to be database.list()...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment