Overview

Project: restlet-jpa
Description: A Restlet extension for automatically exposing JPA entities.
License: CDDL
Current Release: Now hosted on Launchpad

The objective is to enable exposing JPA entities via URLs simple.

Depends on Restlet 1.1.

Example Usage:

public class FooApp extends PersistenceApplication {

  public FooApp() {
    super(Persistence.createEntityManagerFactory("foo");
  }

  @Override
  public Restlet createRoot() {
    EntityRouter router = getEntityRouter();
    router.attach("/foo/", FooCollection.class);
    router.attach("/foo/{id}", FooResource.class);
    return router;
  }
}

@EntityResource(entity = Foo.class)
public class FooResource extends EntityInstance<Foo> { ... }

public class FooCollection extends EntityCollection<Foo> { ... }

Browsing to "/foo/" will retrieve a list of entities and "/foo/{id}" will then retrieve a representation of the entity.

Support

Please use Launchpad for raising issues and asking questions.

Attachments