Shared Collection Sample

This application presents Shared Collection sample. Users can modify the collection rendered on the page and see modifications from other users instantly. (All connections do share same map).

Contents

Server side implementation is present in class SharedCollectionEndpoint. The backing storage is just static map, but it can be easily replaced to something which is backed up by database or some persistent storage. Client side implementation is divided into several files, most important is tyrus-collection.js - it contains implementation of the javascript collection. It is by no means fool proof or complete, there is no handling of connection loss/reconnect.

If you are interested in accessing shared collection from java, you can check out tests - class SharedMap is java.util.Map implementation which does exactly that.

TODO:

Running the Example (Grizzly)

Run the example as follows:

Running the Example (Glassfish)

Run the example as follows: deploy:

$AS_MAIN/bin/asadmin start-domain
$AS_MAIN/bin/asadmin deploy --force ./target/*war

From a web browser, visit:

http://localhost:8080/sample-shared-collection