Package javax.portlet

Examples of javax.portlet.ActionResponse


   * @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...
      res.setRenderParameter(ACTION_PARAM, "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


  @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

            actionRequest =
            PortletObjectAccess.getActionRequest(portletWindow,
                                                 servletRequest,
                                                 servletResponse);

            ActionResponse actionResponse = PortletObjectAccess.getActionResponse(portletWindow,
                                                                                  servletRequest,
                                                                                  servletResponse);
            invoker = PortletInvokerAccess.getPortletInvoker(portletWindow.getPortletEntity().getPortletDefinition());

            _actionResponse = (InternalActionResponse)actionResponse;
View Full Code Here

    public void testActionPortletRequest() throws NoSuchFieldException,
            IllegalAccessException    {
        ApplicationContext applicationContext = createMock(ApplicationContext.class);
        PortletContext portletContext = createMock(PortletContext.class);
        ActionRequest request = createMock(ActionRequest.class);
        ActionResponse response = createMock(ActionResponse.class);

        replay(applicationContext, portletContext, request, response);
        ActionPortletRequest req = new ActionPortletRequest(applicationContext,
                portletContext, request, response);
        Class<? extends ActionPortletRequest> clazz = req.getClass();
View Full Code Here

            String action = namespace + actionName + "!" + renderMethod;
            if (log.isInfoEnabled())
              log.info("Diverting Portlet render action: " + action);

            // set action name
            ActionResponse res = PortletActionContext.getActionResponse();
            res.setRenderParameter(PortletActionConstants.ACTION_PARAM, action);
            sessionMap.put(WebAction.PORTLET_ACTION_RESULT, resultCode);

            // remove RENDER_DIRECT_LOCATION
      sessionMap.remove(RENDER_DIRECT_LOCATION);
        }  
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

            Thread.currentThread().setContextClassLoader(paClassLoader);

        if (method == ContainerConstants.METHOD_ACTION)
        {
            ActionRequest actionRequest = (ActionRequest)portletRequest;           
            ActionResponse actionResponse = (ActionResponse)portletResponse;

                portletInstance.processAction(actionRequest, actionResponse);
        }
        else if (method == ContainerConstants.METHOD_RENDER)
        {
View Full Code Here

        PortletInvokerService invoker = getContainerServices().getPortletInvokerService();

        PortletRequestContext requestContext = rcService.getPortletActionRequestContext(this, request, response, portletWindow);
        PortletActionResponseContext responseContext = rcService.getPortletActionResponseContext(this, request, response, portletWindow);
        ActionRequest portletRequest = envService.createActionRequest(requestContext, responseContext);
        ActionResponse portletResponse = envService.createActionResponse(responseContext);

        FilterManager filterManager = filterInitialisation(portletWindow,PortletRequest.ACTION_PHASE);

        String location = null;
View Full Code Here

            throw new IllegalArgumentException("The specified WindowState '" + windowState + "' is not valid", e);
        }
    }

    public void setPortletMode(ExternalContext externalContext, String portletMode) {
        final ActionResponse actionResponse;
        try {
            actionResponse = (ActionResponse)externalContext.getNativeResponse();
        }
        catch (ClassCastException e) {
            throw new IllegalArgumentException("setPortletMode can only be called during an action request", e);
        }
       
        try {
            actionResponse.setPortletMode(new PortletMode(portletMode));
        }
        catch (PortletModeException e) {
            throw new IllegalArgumentException("The specified PortletMode '" + portletMode + "' is not valid", e);
        }
    }
View Full Code Here

  }
 
 
  public boolean configModeAction(ExternalContext externalContext, String fname) throws IOException {
      final ActionRequest actionRequest = (ActionRequest)externalContext.getNativeRequest();
      final ActionResponse actionResponse = (ActionResponse)externalContext.getNativeResponse();
     
      final PortletSession portletSession = actionRequest.getPortletSession();
      final IPortletWindowId portletWindowId = (IPortletWindowId)portletSession.getAttribute(RenderPortletTag.DEFAULT_SESSION_KEY_PREFIX + fname);
      if (portletWindowId == null) {
          throw new IllegalStateException("Cannot execute configModeAciton without a delegate window ID in the session for key: " + RenderPortletTag.DEFAULT_SESSION_KEY_PREFIX + fname);
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.