/** * For internal use by the framework only - API subject to change. */ public void firePortletActionRequest(UI uI, ActionRequest request, ActionResponse response) { String key = request.getParameter(ActionRequest.ACTION_NAME); if (eventActionDestinationMap.containsKey(key)) { // this action request is only to send queued portlet events response.setEvent(eventActionDestinationMap.get(key), eventActionValueMap.get(key)); // cleanup eventActionDestinationMap.remove(key); eventActionValueMap.remove(key); } else if (sharedParameterActionNameMap.containsKey(key)) { // this action request is only to set shared render parameters response.setRenderParameter(sharedParameterActionNameMap.get(key), sharedParameterActionValueMap.get(key)); // cleanup sharedParameterActionNameMap.remove(key); sharedParameterActionValueMap.remove(key); } else { // normal action request, notify listeners for (PortletListener l : new ArrayList<>(portletListeners)) { l.handleActionRequest(request, response, uI); } } }
/** * The default behavior of this method is to call * <code>setEvent(name, value)</code> on the wrapped response object. */ public void setEvent(QName name, java.io.Serializable value) { response.setEvent(name, value); }
/** * The default behavior of this method is to call * <code>setEvent()</code> on the wrapped response object. */ public void setEvent(String name, java.io.Serializable value) { response.setEvent(name, value); }
@Override public void setEvent(String key, HashMap<String, Object> event) { actionResponse.setEvent(key, event); }
@ActionMapping(params = "action=showCategory") public void showCategory(ActionRequest request, ActionResponse response) { QName qname = new QName("http://liferay.com/events","ipc.messsage","x"); response.setEvent(qname, "some message"); }
@Override public void processAction(ActionRequest request, ActionResponse response) throws PortletException, IOException { response.setEvent(new QName("foo"), "bar"); count = 0; }
@Override public void processAction(ActionRequest request, ActionResponse response) throws PortletException, IOException { response.setEvent(new QName("foo"), null); }
@Override public void processAction(ActionRequest request, ActionResponse response) throws PortletException, IOException { response.setEvent(new QName("foo"), "bar"); count = 0; }
public void processAction(ActionRequest request, ActionResponse response) throws PortletException,IOException { QName qname = new QName("http:applications.portals.apache.org/events" , "AddressEvent"); String address = request.getParameter("address"); if (address == null) { address = ""; } AddressEvent addressEvent = new AddressEvent(); addressEvent.setAddress(address); response.setRenderParameter("address", address); response.setEvent(qname, addressEvent); } }
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"); } } else { throw new IllegalArgumentException("Payload must be serializable for a portlet event"); } } }
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"); } } else { throw new IllegalArgumentException("Payload must be serializable for a portlet event"); } } }
public void execute(Event<UIAccountForm> event) throws Exception { UIAccountForm uiForm = event.getSource(); OrganizationService service = uiForm.getApplicationComponent(OrganizationService.class); UIAccountInputSet uiAccountInput = uiForm.getChild(UIAccountInputSet.class); String userName = uiAccountInput.getUserName(); boolean saveAccountInput = uiAccountInput.save(service, true); if (saveAccountInput == false) return; uiForm.getChild(UIUserProfileInputSet.class).save(service, userName, true); uiForm.reset(); ActionResponse actResponse = event.getRequestContext().getResponse(); actResponse.setEvent(new QName("NewAccountAdded"), null); } }
response.setEvent(SearchConstants.SEARCH_REQUEST_QNAME, queryObj);