send(name, null);
}
public void send(String name, Object payload) {
Request request = Request.getCurrent();
RequestBridge bridge = request.getBridge();
if (payload == null || payload instanceof Serializable) {
Serializable serializablePayload = (Serializable)payload;
if (bridge.getPhase() == Phase.ACTION) {
PortletActionBridge actionBridge = (PortletActionBridge)bridge;
actionBridge.resp.setEvent(name, serializablePayload);
} else if (bridge.getPhase() == Phase.EVENT) {
PortletEventBridge actionBridge = (PortletEventBridge)bridge;
actionBridge.resp.setEvent(name, serializablePayload);
} else {
throw new IllegalStateException("Cannot send event");
}