Package javax.portlet

Examples of javax.portlet.ActionResponse


     */
    public void redirect(String url) throws IOException
    {
        if (this.portletResponse instanceof ActionResponse)
        {
            ActionResponse r = (ActionResponse)this.portletResponse;
            r.sendRedirect(url);
        }
        else
            throw new IOException("Cannot redirect from render phase");
    }
View Full Code Here


                // The view should have been restore.
                // Pass it to the render request.
                request.getPortletSession().setAttribute(
                        createViewRootKey(context, defaultPage, viewId),
                        context.getViewRoot());
                ActionResponse actionResponse = (ActionResponse) response;

                // save FacesMessage objects on session; so they can
                // be restored during the render phase
                saveFacesMessages(context, request.getPortletSession());
            } else if (renderRequest)
View Full Code Here

            Map reqScope = facesContext.getExternalContext().getRequestMap();
            handlers.addAll(ConfigUtils.getRequestHandlers(reqScope));
           
            if (RequestType.ACTION.equals(ExternalContextUtils.getRequestType(context, request)))
            {
                ActionResponse actionResponse = (ActionResponse) response;
               
                PortletRequest portletRequest = (PortletRequest) request;
                nextToken = portletRequest.getParameter(CONVERSATION_CONTEXT_PARAM);
                if (nextToken == null)
                {
                    nextToken = _getNextToken();
                    actionResponse.setRenderParameter(REQUEST_CONTEXT_PARAM, nextToken);                   
                }
                if (nextToken != null)
                {
                    //Put it on application map, to make it available on render response phase
                    externalContext.getApplicationMap().put(REQUEST_HANDLERS+nextToken, handlers);
View Full Code Here

     * @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());

    }
View Full Code Here

     * @param location The location string
     * @param invocation The action 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());

    }
View Full Code Here

     * @param invocation
     */
    protected void executeActionResult(String finalLocation,
            ActionInvocation invocation) {
        LOG.debug("Executing result in Event phase");
        ActionResponse res = PortletActionContext.getActionResponse();
        LOG.debug("Setting event render parameter: " + finalLocation);
        if (finalLocation.indexOf('?') != -1) {
            convertQueryParamsToRenderParams(res, finalLocation
                    .substring(finalLocation.indexOf('?') + 1));
            finalLocation = finalLocation.substring(0, finalLocation
                    .indexOf('?'));
        }
        if (finalLocation.endsWith(".action")) {
            // View is rendered with a view action...luckily...
            finalLocation = finalLocation.substring(0, finalLocation
                    .lastIndexOf("."));
            res.setRenderParameter(PortletActionConstants.ACTION_PARAM, finalLocation);
        } else {
            // View is rendered outside an action...uh oh...
            res.setRenderParameter(PortletActionConstants.ACTION_PARAM, "renderDirect");
            res.setRenderParameter("location", finalLocation);
        }
        res.setRenderParameter(PortletActionConstants.MODE_PARAM, PortletActionContext
                .getRequest().getPortletMode().toString());
    }
View Full Code Here

            }
            proxy.execute();
            if (PortletActionConstants.EVENT_PHASE.equals(phase)) {
                // Store the executed action in the session for retrieval in the
                // render phase.
                ActionResponse actionResp = (ActionResponse) response;
                request.getPortletSession().setAttribute(EVENT_ACTION, proxy);
                actionResp.setRenderParameter(EVENT_ACTION, "true");
            }
        } catch (ConfigurationException e) {
            LOG.error("Could not find action", e);
            throw new PortletException("Could not find action " + actionName, e);
        } catch (Exception e) {
View Full Code Here

     * @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());

    }
View Full Code Here

            }

            if (method == ContainerConstants.METHOD_ACTION)
            {
                ActionRequest actionRequest = (ActionRequest) request.getAttribute(ContainerConstants.PORTLET_REQUEST);
                ActionResponse actionResponse = (ActionResponse) request.getAttribute(ContainerConstants.PORTLET_RESPONSE);
                // inject the current request into the actionRequest handler (o.a.j.engine.servlet.ServletRequestImpl)
                ((HttpServletRequestWrapper)((HttpServletRequestWrapper)actionRequest).getRequest()).setRequest(request);

                portlet.processAction(actionRequest, actionResponse);
            }
View Full Code Here

   * @param finalLocation
   * @param invocation
   */
  protected void executeActionResult(String finalLocation, ActionInvocation invocation) throws Exception {
    LOG.debug("Executing result in Event phase");
    ActionResponse res = PortletActionContext.getActionResponse();
    Map sessionMap = invocation.getInvocationContext().getSession();
    LOG.debug("Setting event render parameter: " + finalLocation);
    if (finalLocation.indexOf('?') != -1) {
      convertQueryParamsToRenderParams(res, finalLocation.substring(finalLocation.indexOf('?') + 1));
      finalLocation = finalLocation.substring(0, finalLocation.indexOf('?'));
    }
    if (finalLocation.endsWith(".action")) {
      // View is rendered with a view action...luckily...
      finalLocation = finalLocation.substring(0, finalLocation.lastIndexOf("."));
      res.setRenderParameter(ACTION_PARAM, finalLocation);
    } else {
      // View is rendered outside an action...uh oh...
            String namespace = invocation.getProxy().getNamespace();
            if ( namespace != null && namespace.length() > 0 && !namespace.endsWith("/")) {
                namespace += "/";
               
            }
            res.setRenderParameter(ACTION_PARAM, namespace + "renderDirect");
      sessionMap.put(RENDER_DIRECT_LOCATION, finalLocation);
    }
    if(portletMode != null) {
      res.setPortletMode(portletMode);
      res.setRenderParameter(PortletActionConstants.MODE_PARAM, portletMode.toString());
    }
    else {
      res.setRenderParameter(PortletActionConstants.MODE_PARAM, PortletActionContext.getRequest().getPortletMode()
          .toString());
    }
  }
View Full Code Here

TOP

Related Classes of javax.portlet.ActionResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.