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.
The following web.xml configuration is required for the ICEpush Servlet.
From the server-side perspective, the ICEpush API is exposed through the org.icepush.PushContext class.
An instance of the PushContext can be obtained from the javax.servlet.ServletContext as follows:
The ServletContext can be easily injected into a Spring 3 bean like so:
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.
Unique pushids are created as follows:
pushids are added and removed from groups as follows:
Group naming employees application-specific strategies. While group naming is orthogonal to JSP bean scopes, they can effectively be associated with a scope.
Notifications are pushed to groups as follows:
Alternately, a Notifier or GroupNotifier bean can be used to initiate notifications. The details of this approach are covered here.
The basic ICEpush notification mechanism can take advantage of Cloud Push by simply adding a PushNotification message to the push() call, like this:
Additional application configuration is required to include the various Cloud Push connectors required for Cloud Push. See the Cloud Push Overview for details.
Alternatively, mobi:deviceResource can be used like so:
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:
Learn more about all the available ICEpush tags, and notification infrastructure here.
© Copyright 2016 ICEsoft Technologies Canada Corp.