Package javax.portlet

Examples of javax.portlet.ActionResponse


  @SuppressWarnings("unchecked")
  private void saveStack(ActionInvocation invocation) {
    Map session = invocation.getInvocationContext().getSession();
    session.put(STACK_FROM_EVENT_PHASE, invocation.getStack());
    ActionResponse actionResponse = (ActionResponse) invocation.getInvocationContext().get(RESPONSE);
    actionResponse.setRenderParameter(EVENT_ACTION, "true");
  }
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
     * @param invocation
     */
    private void executeActionResult(String location,
                                     ActionInvocation invocation) {
        ActionResponse res = PortletActionContext.getActionResponse();
        // View is rendered outside an action...uh oh...
    invocation.getInvocationContext().getSession().put(RENDER_DIRECT_LOCATION, location);
        res.setRenderParameter(PortletActionConstants.ACTION_PARAM, "freemarkerDirect");
        res.setRenderParameter(PortletActionConstants.MODE_PARAM, PortletActionContext
                .getRequest().getPortletMode().toString());

    }
View Full Code Here

  @SuppressWarnings("unchecked")
  private void saveStack(ActionInvocation invocation) {
    Map session = invocation.getInvocationContext().getSession();
    session.put(STACK_FROM_EVENT_PHASE, invocation.getStack());
    ActionResponse actionResponse = (ActionResponse) invocation.getInvocationContext().get(RESPONSE);
    actionResponse.setRenderParameter(EVENT_ACTION, "true");
  }
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...
        String namespace = invocation.getProxy().getNamespace();
        if ( namespace != null && namespace.length() > 0 && !namespace.endsWith("/")) {
            namespace += "/";

        }
        res.setRenderParameter(PortletActionConstants.ACTION_PARAM, namespace + "freemarkerDirect");
        res.setRenderParameter("location", location);
        res.setRenderParameter(PortletActionConstants.MODE_PARAM, PortletActionContext
                .getRequest().getPortletMode().toString());

    }
View Full Code Here

   * @param finalLocation
   * @param invocation
   */
  protected void executeActionResult(String finalLocation, ActionInvocation invocation) throws Exception {
    if (LOG.isDebugEnabled()) LOG.debug("Executing result in Event phase");
    ActionResponse res = PortletActionContext.getActionResponse();
    Map sessionMap = invocation.getInvocationContext().getSession();
    if (LOG.isDebugEnabled()) 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

      super.setUp();
    interceptor = new PortletStateInterceptor();
  }
 
  public void testCopyValueStackFromEventToRenderPhase() throws Exception {
    ActionResponse actionResponse = EasyMock.createNiceMock(ActionResponse.class);
    ActionInvocation invocation = EasyMock.createNiceMock(ActionInvocation.class);
   
    Map<String, Object> ctxMap = new HashMap<String, Object>();
    ctxMap.put(PHASE, EVENT_PHASE);
    ctxMap.put(RESPONSE, actionResponse);
    Map<String, Object> session = new HashMap<String, Object>();
   
    ActionContext ctx = new ActionContext(ctxMap);
    ctx.setSession(session);
    EasyMock.expect(invocation.getInvocationContext()).andStubReturn(ctx);
    actionResponse.setRenderParameter(EVENT_ACTION, "true");
   
    ValueStack stack = container.getInstance(ValueStackFactory.class).createValueStack();
    EasyMock.expect(invocation.getStack()).andStubReturn(stack);
   
    EasyMock.replay(actionResponse);
View Full Code Here

      url = actionURL.toString();
      url = url.replaceAll("\\&amp\\;", "&");
    }
    else
    { // action - write the viewId to navigational state
      ActionResponse actionResponse = (ActionResponse) getResponse();

      // set request params into navigational states
      Enumeration<String> list = queryStr.getParameterNames();
      while (list.hasMoreElements())
      {
        String param = list.nextElement();
        if (param.equals(Bridge.PORTLET_MODE_PARAMETER))
        {
          try
          {
            actionResponse.setPortletMode(new PortletMode(queryStr.getParameter(param)));
          }
          catch (Exception e)
          {
            //TODO: Ignoring is probably dangerous here as it means that we are
            //      EITHER using exceptions for flow control (which is extreemly
            //      inefficient) or we should log a message saying what the issue
            //      is.  According to the Javadocs an exception is thrown here if the
            //      portlet mode is not allowed or if sendRedirect has already been
            //      called.  In either case we should log an information type message
            //      here.
            ; // do nothing -- just ignore
          }
        }
        else if (param.equals(Bridge.PORTLET_WINDOWSTATE_PARAMETER))
        {
          try
          {
            actionResponse.setWindowState(new WindowState(queryStr.getParameter(param)));
          }
          catch (Exception e)
          {
            ; // do nothing -- just ignore
          }
        }
        else if (param.equals(Bridge.PORTLET_SECURE_PARAMETER))
        {
          ; // ignore -- do nothing as can't encode into an actionResponse
        }
        else
        {
          actionResponse.setRenderParameter(param, queryStr.getParameter(param));
        }
      }
    }
    // Because we want to support translating a redirect that occurs
    // during a render as an in place navigation AND we can't reverse
View Full Code Here

                portletClass.render(renderRequest,renderResponse);
            }
            else if (method_id==org.apache.pluto.Constants.METHOD_ACTION)
            {
                ActionRequest actionRequest = (ActionRequest)request.getAttribute(org.apache.pluto.Constants.PORTLET_REQUEST);
                ActionResponse actionResponse = (ActionResponse)request.getAttribute(org.apache.pluto.Constants.PORTLET_RESPONSE);

                // prepare container objects to run in this webModule
                prepareActionRequest(actionRequest, request);
                prepareActionResponse(actionResponse, request, response);
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(PortletConstants.ACTION_PARAM, "freemarkerDirect");
        res.setRenderParameter("location", location);
        res.setRenderParameter(PortletConstants.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.