ICEpush Integration

Table of Contents

ICEpush Integration

The icepush.jar must be included in the application to enable Ajax Push capabilities. A servlet handles all ICEpush-related requests, and a Java API supports push group definition, and pushing of notifications from the application business logic. A JSP tag library is used to enable Ajax Push in the JSP pages that will receive push updates.

Servlet Configuration

The following web.xml configuration is required for the ICEpush Servlet.

<servlet>
    <servlet-name>icepush</servlet-name>
    <servlet-class>org.icepush.servlet.ICEpushServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>icepush</servlet-name>
    <url-pattern>*.icepush</url-pattern>
</servlet-mapping>

Java API

From the server-side perspective, the ICEpush API is exposed through the org.icepush.PushContext class.

Instantiation

An instance of the PushContext can be obtained from the javax.servlet.ServletContext as follows:

PushContext pc = PushContext.getInstance(servletContext);

The ServletContext can be easily injected into a Spring 3 bean like so:

@Inject
private WebApplicationContext context;

The ICEpush JSP tag library also provides a mechanism for injecting the PushContext into a Notifier bean that is responsible for triggering notifications. The details of this approach are covered here.

PushIds

Unique pushids are created as follows:

String pushId = pushContext.createPushId();

Group Membership

pushids are added and removed from groups as follows:

pushContext.addGroupMember("myGroup", pushId);
pushContext.removeGroupMember("myGroup", pushId);

Group Naming

Group naming employees application-specific strategies. While group naming is orthogonal to JSP bean scopes, they can effectively be associated with a scope.

  • Window-scoped groups are not named, and use only the unique pushID assigned during registration. These names/pushIDs will change each time the page is loaded.
  • Session-scoped groups include the session ID: group="${session.id}.myGroup"
  • Application-scoped groups have static names: group="myGroup"

Notification

Notifications are pushed to groups as follows:

pushContext.push("myGroup");

Alternately, a Notifier or GroupNotifier bean can be used to initiate notifications. The details of this approach are covered here.

Cloud Push

The basic ICEpush notification mechanism can take advantage of Cloud Push by simply adding a PushNotification message to the push() call, like this:

pushContext.push("myGroup", new PushNotification("myCloudTitle", "myCloudMessage");

Additional application configuration is required to include the various Cloud Push connectors required for Cloud Push. See the Cloud Push Overview for details.

JSP Pages

You must include the ICEpush Javascript bridge in any page that will receive Ajax Push updates.

<script type="text/javascript" src="/app/code.icepush"></script>

Alternatively, mobi:deviceResource can be used like so:

<mobi:deviceResource includePush="true"/>

The simplest way to use Ajax Push in a page is the ICEpush region tag, which lets you associate a region on the page containing dynamic markup with a named push group. When a notification occurs for the group, the region is updated with the newly rendered content. The region tag is used like so:

<push:region group="myGroupName" page="/myUpdateRegion"/>

Learn more about all the available ICEpush tags, and notification infrastructure here.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

© Copyright 2016 ICEsoft Technologies Canada Corp.