Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">


    Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.

    The contents of this file are subject to the terms of either the GNU
    General Public License Version 2 only ("GPL") or the Common Development
    and Distribution License("CDDL") (collectively, the "License").  You
    may not use this file except in compliance with the License.  You can
    obtain a copy of the License at
    or packager/legal/LICENSE.txt.  See the License for the specific
    language governing permissions and limitations under the License.

    When distributing the software, include this License Header Notice in each
    file and include the License file at packager/legal/LICENSE.txt.

    GPL Classpath Exception:
    Oracle designates this particular file as subject to the "Classpath"
    exception as provided by Oracle in the GPL Version 2 section of the License
    file that accompanied this code.

    If applicable, add the following below the License Header, with the fields
    enclosed by brackets [] replaced by your own identifying information:
    "Portions Copyright [year] [name of copyright owner]"

    If you wish your version of this file to be governed by only the CDDL or
    only the GPL Version 2, indicate your decision by adding "[Contributor]
    elects to include this software in this distribution under the [CDDL or GPL
    Version 2] license."  If you don't indicate a single choice of license, a
    recipient has the option to distribute your version of this file under
    either the CDDL, the GPL Version 2 or to extend the choice of license to
    its licensees as provided above.  However, if you add GPL Version 2 code
    and therefore, elected the GPL Version 2 license, then the option applies
    only if the new code is made subject to such option by the copyright

<html><head><title>Shared Collection Sample</title></head>

<h1>Shared Collection Sample</h1>

<p>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).</p>


<p>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.</p>

<p>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.</p>

    <li>connection loss/reconnect</li>
    <li>granular update event (client side)</li>
    <li>persistent store (server side)</li>
    <li>subscribe/publish collections - include dynamic map name</li>

<h2>Running the Example (Grizzly)</h2>
<p>Run the example as follows:

    <li>From the sample root directory execute <blockquote><code>mvn clean test-compile exec:java</code></blockquote></li>
    <li>Visit page: <blockquote><code><a href="http://localhost:8025/index.html">http://localhost:8025/index.html</a></code></blockquote></li>

<h2>Running the Example (Glassfish)</h2>
<p>Run the example as follows:
<blockquote><code>$AS_MAIN/bin/asadmin start-domain</code></blockquote>
<blockquote><code>$AS_MAIN/bin/asadmin deploy --force ./target/*war</code></blockquote>

<p>From a web browser, visit:</p>
<blockquote><code><a href="http://localhost:8080/sample-shared-collection">http://localhost:8080/sample-shared-collection</a></code></blockquote>