Examples of ActionResponse


Examples of javax.portlet.ActionResponse

            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

Examples of javax.portlet.ActionResponse

  }
 
 
  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

Examples of javax.portlet.ActionResponse

      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

Examples of javax.portlet.ActionResponse

        request.getPortletSession(true).setAttribute(
                PortletConstants.PORTLET_EXCEPTION_MARKUP_ATTRIBUTE,
                markup);

        ActionResponse response = _globals.getActionResponse();

        response.setRenderParameter(ServiceConstants.SERVICE, PortletConstants.EXCEPTION_SERVICE);
    }
View Full Code Here

Examples of javax.portlet.ActionResponse

            request.getPortletSession(true).setAttribute(
                    PortletConstants.PORTLET_EXCEPTION_MARKUP_ATTRIBUTE,
                    markup);

            ActionResponse response = _globals.getActionResponse();

            response.setRenderParameter(
                    ServiceConstants.SERVICE,
                    PortletConstants.EXCEPTION_SERVICE);
        }
        catch (Exception ex)
        {
View Full Code Here

Examples of javax.portlet.ActionResponse

    public void testActionBridgeSuccess() throws Exception
    {
        ActionRequest request = (ActionRequest) newMock(ActionRequest.class);

        MockControl responsec = newControl(ActionResponse.class);
        ActionResponse response = (ActionResponse) responsec.getMock();

        PortletRequestGlobals prg = (PortletRequestGlobals) newMock(PortletRequestGlobals.class);
        WebRequestServicerFixture wrs = new WebRequestServicerFixture();

        prg.store(request, response);

        request.removeAttribute("FOO");
        response.encodeURL("FOO");
        responsec.setReturnValue(null);

        replayControls();

        ActionRequestServicerToWebRequestServicerBridge bridge = new ActionRequestServicerToWebRequestServicerBridge();
View Full Code Here

Examples of javax.portlet.ActionResponse

    }

    public void testActionBridgeFailure() throws Exception
    {
        ActionRequest request = (ActionRequest) newMock(ActionRequest.class);
        ActionResponse response = (ActionResponse) newMock(ActionResponse.class);
        PortletRequestGlobals prg = (PortletRequestGlobals) newMock(PortletRequestGlobals.class);

        MockControl control = newControl(WebRequestServicer.class);
        WebRequestServicer servicer = (WebRequestServicer) control.getMock();
View Full Code Here

Examples of javax.portlet.ActionResponse

    public void testSuccess() throws Exception
    {
        IPage page = newPage("Frodo");
        IRequestCycle cycle = newCycle(page);
        ActionResponse response = newResponse();

        response.setRenderParameter(ServiceConstants.SERVICE, PortletConstants.RENDER_SERVICE);
        response.setRenderParameter(ServiceConstants.PAGE, "Frodo");

        replayControls();

        PortletResponseRenderer renderer = new PortletResponseRenderer();
        renderer.setResponse(response);
View Full Code Here

Examples of javax.portlet.ActionResponse

            request.getPortletSession(true).setAttribute(
                    PortletConstants.PORTLET_EXCEPTION_MARKUP_ATTRIBUTE,
                    cause.getMessage());

            ActionResponse response = _globals.getActionResponse();

            response.setRenderParameter(
                    ServiceConstants.SERVICE,
                    PortletConstants.EXCEPTION_SERVICE);
        }
        catch (Exception ex)
        {
View Full Code Here

Examples of javax.portlet.ActionResponse

        portlet.init(config);

        verifyControls();

        ActionRequest request = newActionRequest();
        ActionResponse response = newActionResponse();

        registry.setupThread();
       
        actionRequestServicer.service(request, response);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.