apache/wicket — pull request #32 by Floaz (2013-02-23 20:37:58+00:00)
Title: Added another subscription method to wicket-atmosphere.

Wicket-atmosphere provides only the method-subscription method. The nice concept of the subscription methods have one penalty: It is not possible to add a filter with context variables before the request context is loaded. E.g. self-made channels or other checks with variables of components.

I hope there is no error in concept.

Example:

@Override
protected void onInitialize() {
super.onInitialize();

final Number id = getWatchId();

AtmosphereEventSubscriber s = new AtmosphereEventSubscriber(this);
s.subscribe(CommentEvent.class, new AtmosphereEventSubscription() {
@Override
public void call(AjaxRequestTarget target, CommentEvent event) {
logger.debug("Comment with id=" + event.getId());
}
}, new Predicate() {
@Override
public boolean apply(CommentEvent event) {
return id.equals(event.getId());
}
});
}