org.primefaces.push.PushRule Maven / Gradle / Ivy
package org.primefaces.push;
import org.atmosphere.cpr.AtmosphereResource;
/**
* A PushRule configure the Atmosphere Framework behavior. By default, the {@link DefaultPushRule} is used to creates
* channel of communication based on the value of the request's pathInfo.
*
* PushRule can be implemented to customize the behavior of Atmosphere and to create channel (named {@link org.atmosphere.cpr.Broadcaster})
* on the fly. For example, the following PushRule will create a single Channel of communication. All invocation of
* {@link PushContext#push(String, Object)} will be shared to all connected browser
*
* boolean apply(AtmosphereResource resource) {
* Broadcaster all = BroadcasterFactory.getDefault().lookup("/*", true);
* resource.setBroadcaster(all);
* return true;
* }
*
*
* For more information on how to manipulate the Atmosphere's object, see
*
* https://github.com/Atmosphere/atmosphere/wiki/Understanding-BroadcasterBroadcaster
* AtmosphereResource
*
* @deprecated With PrimeFaces 4.1 and up, it is recommended to use {@link @PushEndpoint}
*/
public interface PushRule {
/**
* Configure an {@link AtmosphereResource} and creates channel of communication on the fly.
* @param resource an {@link AtmosphereResource}
* @return true if other rule can be invoked, false if this rule terminate the process.
*/
boolean apply(AtmosphereResource resource);
}