This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information

JVx 1.0 with REST support

Some of you asked us: When is JVx 1.0 available?

The answer was and is still: This year :)
More precisely: Planned release date is Friday, 23rd December.

The current version in our SVN repository is Feature complete. Only some tickets are still open, but all of them are not really important for 1.0. Some are beautifying and some are smaller bugs that do not hurt.
We are optimistic that these are done till Friday, otherwise the open tickets will be moved to Release 1.1.

In addition to numerous changes and new features, the REST support is certainly one of the most interesting innovation. The feature was not originally planned for 1.0, but it is cool nowadays.

But what do we understand as "REST support"?

Every server-side action, and every object that is available via a Life-Cycle object, are accessible via REST calls. Don't worry about security, because the same access checks are done as for common applications. If an action or object is available for an application, it is available via REST calls.
You don't need additional configurations for your applications, actions or objects - no annotations and no config files are needed.

It sounds simple? Yes, it is so simple!

I want to show you a short example, based on Restlet. We have a life-cycle object like the following:

public class Address extends Session
{
  public DBStorage getAddress() throws Throwable
  {
    DBStorage dbs = (DBStorage)get("address");
       
    if (dbs == null)
    {
      dbs = new DBStorage();

      dbs.setDBAccess(getDBAccess());
      dbs.setWritebackTable("ADDRESS");
      dbs.open();
               
      put("address", dbs);
    }
               
    return dbs;
  }

  public String getData()
  {
    return "Text data";
  }

}

The object has one action "getData" and the object "address".

Now we call the action:

String sHost = "http://localhost/jvx/services/rest/demo/Address/action/getData";

ClientResource cres = new ClientResource(sHost);

Representation rep = cres.get();

String sData = JSONUtil.getObject(rep, String.class);

And we fetch all records:

String sHost = "http://localhost/jvx/services/rest/demo/Address/data/address";

ClientResource cres = new ClientResource(sHost);

Representation rep = cres.get();

List liRecords = JSONUtil.getObject(rep, List.class);

Is it as simple as expected? We hope so ;-)

Of course, there are options for fetching only specific records. Insert new records, update and delete one or more records. All options are implemented in test cases. Have a look at the Action or Storage tests.

More details and the documentation will follow after the release of JVx 1.0.