[infinispan-dev] Infinispan REST server

Michael Neale michael.neale at gmail.com
Thu Aug 27 06:02:01 EDT 2009


Hey all.

(brief into: I am Mic, work for JBoss, on Drools and other things, I
got chatting to Manik one day and on a cold sunday morning started
hacking...)

I have been working on a RESTful server using RESTEasy as part of the
infinispan server effort. Its really quite easy to do, but I believe
useful for some cases I have in mind (involving non java clients)...

For the moment, while I play with things and then tidy up, I have
thrown the code up here:
http://github.com/michaelneale/Infinispan-rest/tree/master but plan to
put this in the infinispan tree when happy (it is a war, but we can
also have stand alone distros).

The basic cache operations map pretty nicely to HTTP verbs, GET, PUT,
DELETE (can wipe out an element or a whole cache) etc etc... with meta
info in the headers etc... (will be documenting it shortly, probably
on the wiki). For example, a http PUT to /foo/bar puts an element with
a key value of "foo" in the named cache "bar" (one cache manager
config per running server instance). Content-Type headers are needed
so the GET can operate correctly (also, this will probably be useful
down the track for indexing for search/queries, as the payload data
itself is a byte[] from the request body entity/stream).

I am also working on making it honour "eTags" - which are quite handy
(a GET with an eTag means it doesn't have to return the result if it's
copy is already good). This means you could, for instance, use
infinispan as a pretty dynamic content distribution network, pushing
out content updates as often as you like, but taking the load of the
servers (and network) where possible. Another option with persistence
is basically similar to the amazon s3 service (including per cache or
"bucket" ACLs, not hard to do)... many possibilities...

Some questions: I need to track things like "created" or "updated"
time etc.. things that the cache would track - but I can't work out
how to get at that data (so I can put it in the CacheEntry object, but
it seems redundant???) - ideas?

Also, if there a way to list the named caches in a cache manager?
(just thinking as an optional feature).


Anyway, love to hear ideas...


Michael.



More information about the infinispan-dev mailing list