REST Api (was Re: Custom UI? )

Heiko W.Rupp hrupp at redhat.com
Mon Jun 6 10:21:54 UTC 2011


Hi,

I sat down over the weekend (and some time this morning) to implement a first REST provider.
This code is in git in branch heiko-rest ( http://git.fedorahosted.org/git/?p=rhq/rhq.git;a=shortlog;h=refs/heads/heiko-rest ).

The code is *far from production* but serves for bootstrapping the REST api work.
If you want to play with it, you need to run a container build so that the rest libraries get copied to server/default/lib.

Aside from the pure providing of resources , there are two technical issues still to solve:

* accessing resources (e.g. http://localhost:7080/rest/resource/r/10001 ) will result in a LazyLoad exception,
 as the marshalling code works outside the EJBs with JPA sessions in the servlet code.
* How to impose security ?

My guess is that both cases could be handled by some sort of Servlet filters. The first case could also be addressed
by "DTOs" tailored for the REST api (but I'd like to use the standard domain objects).

For a successful call use the url http://localhost:7080/rest/resource/a/10001 (assuming you have resources
in inventory).

  Heiko



More information about the rhq-devel mailing list