/** * 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); } } }
@Override public void sendRedirect(String location) throws IOException { ((ActionResponse)response).sendRedirect(location); }
actionResponse.sendRedirect(url); FacesContext facesContext = FacesContext.getCurrentInstance(); PortalContext portalContext = bridgeContext.getPortletRequest().getPortalContext(); String createRenderUrlDuringActionPhaseSupport = portalContext.getProperty( BridgePortalContext.CREATE_RENDER_URL_DURING_ACTION_PHASE_SUPPORT); actionResponse.sendRedirect(bridgeURI.toString()); String contextPath = bridgeContext.getPortletRequest().getContextPath(); String newViewId = bridgeURI.getContextRelativePath(contextPath); UIViewRoot viewRoot = facesContext.getViewRoot(); String currentFacesViewId = viewRoot.getViewId(); ViewHandler viewHandler = facesContext.getApplication().getViewHandler(); UIViewRoot newViewRoot = viewHandler.createView(facesContext, newViewId); facesContext.setViewRoot(newViewRoot);
public FacesContext getFacesContext(final FacesContext facesContext, Object context, Object request, Object response) throws FacesException ExternalContext externalContext = facesContext.getExternalContext(); List handlers = null; boolean init = false; String nextToken = null; Map requestMap = externalContext.getRequestMap(); nextToken = portletRequest.getParameter(CONVERSATION_CONTEXT_PARAM); if (nextToken == null) nextToken = portletRequest.getParameter(REQUEST_CONTEXT_PARAM); handlers = (List) externalContext.getApplicationMap().remove(REQUEST_HANDLERS+nextToken); handlers.add(new DataSourceLeakRequestHandler()); Map reqScope = facesContext.getExternalContext().getRequestMap(); handlers.addAll(ConfigUtils.getRequestHandlers(reqScope)); nextToken = portletRequest.getParameter(CONVERSATION_CONTEXT_PARAM); if (nextToken == null) actionResponse.setRenderParameter(REQUEST_CONTEXT_PARAM, nextToken);
FacesContext.getCurrentInstance().responseComplete(); ((ActionResponse) getResponse()).sendRedirect(url); FacesContext.getCurrentInstance().responseComplete();
/** * Called by the portlet container to allow the portlet to process an action request. */ public void processAction(ActionRequest request, ActionResponse response) throws PortletException, IOException { if (log.isTraceEnabled()) log.trace("called processAction"); if (sessionTimedOut(request)) return; setPortletRequestFlag(request); FacesContext facesContext = facesContext(request, response); try { lifecycle.execute(facesContext); if (!facesContext.getResponseComplete()) { response.setRenderParameter(VIEW_ID, facesContext.getViewRoot().getViewId()); } request.getPortletSession().setAttribute(CURRENT_FACES_CONTEXT, facesContext); } catch (Throwable e) { facesContext.release(); handleExceptionFromLifecycle(e); } }
bridgeRequestScope.setPortletMode(actionRequest.getPortletMode()); String portletModeParam = actionRequest.getParameter(Bridge.PORTLET_MODE_PARAMETER); actionResponse.setPortletMode(new PortletMode(portletModeParam)); indicateNamespacingToConsumers(facesContext.getViewRoot(), actionResponse);
public void processAction(ActionRequest request, ActionResponse response) throws IOException, PortletException { String destinationName = request.getParameter(DESTINATION_NAME); String destinationType = request.getParameter(DESTINATION_TYPE); response.setRenderParameter("destinationName", destinationName); response.setRenderParameter("destinationType", destinationType); response.setRenderParameter("processAction", "statistics"); }
sessionMap, applicationMap, request, response, getPortletConfig(), phase); PortletMode mode = request.getPortletMode(); String actionName = mapping.getName(); String namespace = mapping.getNamespace(); ActionProxy proxy = factory.createActionProxy(namespace, actionName, extraContext); request.setAttribute("webwork.valueStack", proxy.getInvocation() .getStack()); if (PortletActionConstants.RENDER_PHASE.equals(phase) && StringUtils.isNotEmpty(request .getParameter(EVENT_ACTION))) { ActionProxy action = (ActionProxy) request.getPortletSession() request.getPortletSession().setAttribute(EVENT_ACTION, proxy); actionResp.setRenderParameter(EVENT_ACTION, "true");
public void processAction(ActionRequest request, ActionResponse response) throws PortletException, IOException if (request.getPortletMode() == PortletMode.EDIT) try response.setPortletMode(PortletMode.EDIT); return; PortletPreferences prefs = request.getPreferences(); PreferencesHelper.requestParamsToPreferences(request); prefs.store(); response.setPortletMode(PortletMode.EDIT); response.setRenderParameter("configPage", editAction); response.setRenderParameter(TABLE_NAME, request.getParameter(TABLE_NAME)); return; response.setPortletMode(PortletMode.EDIT); return; PortletPreferences prefs = request.getPreferences(); PreferencesHelper.requestParamsToPreferences(request); prefs.store(); response.setPortletMode(PortletMode.VIEW); RequestContext jsReqContext = (RequestContext) request.getAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE); response.sendRedirect(request.getContextPath().replace( request.getContextPath(), jsReqContext.getPortalURL().getBasePath().subSequence(
if (wicketURL.startsWith(wicketFilterPath)) String portletMode = request.getPortletMode().toString(); String wicketUrlPrefix = (String)request.getAttribute(WicketPortlet.WICKET_URL_PORTLET_PARAMETER_ATTR); String redirectUrlKey = wicketUrlPrefix + portletMode; response.setRenderParameter(redirectUrlKey, wicketURL); response.sendRedirect(redirectLocationUrl);
public void processAction(ActionRequest request, ActionResponse response) throws PortletException, IOException if (request.getPortletMode() == PortletMode.EDIT) String test = request.getParameter("Test"); if (test != null && test.equals("Test")) try response.setPortletMode(PortletMode.EDIT); return; PortletPreferences prefs = request.getPreferences(); PreferencesHelper.requestParamsToPreferences(request); prefs.store(); response.setPortletMode(PortletMode.EDIT); response.setRenderParameter("configPage", editAction); response.setRenderParameter(TABLE_NAME, request.getParameter(TABLE_NAME)); return; response.setPortletMode(PortletMode.EDIT); return; PortletPreferences prefs = request.getPreferences(); PreferencesHelper.requestParamsToPreferences(request); prefs.store(); response.setPortletMode(PortletMode.VIEW);
public void showById(ActionRequest actionRequest, ActionResponse actionResponse) throws IOException, PortletException { PortletPreferences prefs = actionRequest.getPreferences(); String id = actionRequest.getParameter("id"); if(id != null) { prefs.setValue("id", id); prefs.store(); } String mvcPath = actionRequest.getParameter("mvcPath"); // this would tell the render method to show the required JSP actionResponse.setRenderParameter("mvcPath", mvcPath); }
private void handleConfigForm(ActionRequest actionRequest, ActionResponse actionResponse) throws PortletException, IOException { PortletPreferences preferences = actionRequest.getPreferences(); String rootSpace = actionRequest.getParameter(ROOT_SPACE_PARAM_NAME); preferences.setValue(XWikiPortletRequest.ROOT_SPACE_PREF_NAME, rootSpace); actionResponse.setPortletMode(PortletMode.VIEW); preferences.store(); if (logger.isDebugEnabled()) { logger.debug("New root space is [" + rootSpace + "]"); } }
LOG.debug("redirectURL after include:" + redirectLocationUrl); if (redirectLocationUrl != null && !redirectLocationUrl.isEmpty()) { redirectLocationUrl = fixWicketUrl(wicketURL, redirectLocationUrl, request.getScheme()); if (redirectLocationUrl.startsWith(wicketFilterPath)) { final String portletMode = request.getPortletMode().toString(); final String redirectUrlKey = WICKET_URL_PORTLET_PARAMETER + portletMode; response.setRenderParameter(redirectUrlKey, redirectLocationUrl); response.sendRedirect(redirectLocationUrl);
@ActionMapping public void submitSearch( ActionRequest request, ActionResponse response, @RequestParam(value = "query", required = false) String query) { // Should we request to maximize? PortletPreferences prefs = request.getPreferences(); boolean maximize = Boolean.parseBoolean( prefs.getValue(MAXIMIZE_ON_SEARCH_PREFERENCE, "true")); // default is true if (maximize) { try { response.setWindowState(WindowState.MAXIMIZED); } catch (WindowStateException e) { log.warn("Failed to set the window state to MAXIMIZED", e); } } // Forward the query parameter... if (query != null) { response.setRenderParameter("query", query); } }
throws IOException { final PortletSession session = request.getPortletSession(); final String queryId = RandomStringUtils.randomAlphanumeric(32); "Rejecting search for '{}', exceeded max queries per minute for user", query); if (!ajax) { response.setRenderParameter("hitMaxQueries", Boolean.TRUE.toString()); response.setRenderParameter("query", query); } else { final String contextPath = request.getContextPath(); response.sendRedirect(contextPath + AJAX_MAX_QUERIES_URL); response.setEvent(SearchConstants.SEARCH_REQUEST_QNAME, queryObj); response.setRenderParameter("queryId", queryId); response.setRenderParameter("query", query);
/** * @param location * @param invocation */ private void executeActionResult(String location, ActionInvocation invocation) { ActionResponse res = PortletActionContext.getActionResponse(); // View is rendered outside an action...uh oh... res.setRenderParameter(PortletActionConstants.ACTION_PARAM, "freemarkerDirect"); res.setRenderParameter("location", location); res.setRenderParameter(PortletActionConstants.MODE_PARAM, PortletActionContext .getRequest().getPortletMode().toString()); }
@ActionMapping(params = "action=update") public void updateSkinConfiguration( ActionRequest request, ActionResponse response, PortletPreferences prefs) throws IOException, ReadOnlyException, ValidatorException, PortletModeException { // Get the list of preferences and pull them from the request and store into preferences Enumeration<String> preferenceNames = prefs.getNames(); while (preferenceNames.hasMoreElements()) { String name = preferenceNames.nextElement(); if ("PREFdynamicSkinName".equals(name)) { SortedSet<String> skins = skinService.getSkinNames(request); String formValue = request.getParameter(name); if (skins.contains(formValue)) { log.debug("Skin name {} found", formValue); prefs.setValue(name, formValue != null ? formValue : ""); } else { log.warn("Skin name {} is not recognized", formValue); } } else if (name.startsWith(DynamicRespondrSkinConstants.CONFIGURABLE_PREFIX)) { String formValue = request.getParameter(name); prefs.setValue(name, formValue != null ? formValue : ""); } } prefs.store(); log.debug("Saved updated configuration"); response.setPortletMode(PortletMode.VIEW); }
protected void setRenderParameters(ActionRequest request, ActionResponse response) { Enumeration enu = request.getParameterNames(); while (enu.hasMoreElements()) { String key = (String) enu.nextElement(); response.setRenderParameter(key, request.getParameter(key)); } }