Package javax.portlet

Examples of javax.portlet.StateAwareResponse


   
    if (BridgeUtil.getPortletRequestPhase() ==
        Bridge.PortletPhase.ACTION_PHASE)
    {
      // Create and raise the event
      StateAwareResponse response = (StateAwareResponse) extCtx.getResponse();
      response.setEvent(new QName(EVENT_QNAME, EVENT_NAME), testRunner.getTestName());
     
      return Constants.TEST_SUCCESS; // action Navigation result
    }
    else if (BridgeUtil.getPortletRequestPhase() ==
        Bridge.PortletPhase.RENDER_PHASE)
View Full Code Here


     
      ELResolver facesResolver = context.getELContext().getELResolver();
      String userName = ((UserNameBean) facesResolver.getValue(context.getELContext(), null, "userNameBean")).getUserName();

      // Raise a portlet event indicating the userName has changed
      StateAwareResponse response = (StateAwareResponse) context.getExternalContext().getResponse();
     
      response.setRenderParameter("userName", userName);
     
      response.setEvent(new QName("http://myfaces.apache.org/portlet-bridge/event_ns", "myfaces.apache.org.helloDuke.userNameChanged"), userName);
    }
View Full Code Here

    }
    else if (getPortletPhase() == Bridge.PortletPhase.ACTION_PHASE ||
             getPortletPhase() == Bridge.PortletPhase.EVENT_PHASE)
    { // action - write the viewId to navigational state
      StateAwareResponse stateResponse = (StateAwareResponse) 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
          {
            stateResponse.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
          {
            stateResponse.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
        {
          stateResponse.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

      url = url.replaceAll("\\&amp\\;", "&");
    }
    else if (getPortletPhase() == Bridge.PortletPhase.ACTION_PHASE ||
             getPortletPhase() == Bridge.PortletPhase.EVENT_PHASE)
    { // action - write the viewId to navigational state
      StateAwareResponse stateResponse = (StateAwareResponse) 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
          {
            stateResponse.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
          {
            stateResponse.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
        {
          stateResponse.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

    methodInvoker.updateModelAttributes(
        handler, (mav != null ? mav.getModel() : null), implicitModel, webRequest);

    // Expose implicit model for subsequent render phase.
    if (response instanceof StateAwareResponse && !implicitModel.isEmpty()) {
      StateAwareResponse stateResponse = (StateAwareResponse) response;
      Map<?, ?> modelToStore = implicitModel;
      try {
        stateResponse.setRenderParameter(IMPLICIT_MODEL_RENDER_PARAMETER, Boolean.TRUE.toString());
        if (response instanceof EventResponse) {
          // Update the existing model, if any, when responding to an event -
          // whereas we're replacing the model in case of an action response.
          Map<String, Object> existingModel = (Map<String, Object>) request.getPortletSession().getAttribute(IMPLICIT_MODEL_SESSION_ATTRIBUTE);
          if (existingModel != null) {
View Full Code Here

      url = url.replaceAll("\\&amp\\;", "&");
    }
    else if (getPortletPhase() == Bridge.PortletPhase.ACTION_PHASE ||
             getPortletPhase() == Bridge.PortletPhase.EVENT_PHASE)
    { // action - write the viewId to navigational state
      StateAwareResponse stateResponse = (StateAwareResponse) 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
          {
            stateResponse.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
          {
            stateResponse.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
        {
          stateResponse.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

        return request_.getPortletMode();
    }

    public void setApplicationMode(PortletMode mode) throws PortletModeException {
        if (response_ instanceof StateAwareResponse) {
            StateAwareResponse res = (StateAwareResponse) response_;
            res.setPortletMode(mode);
        } else {
            throw new PortletModeException("The portlet don't support to set a portlet mode by current runtime environment",
                    mode);
        }
    }
View Full Code Here

   public void setApplicationMode(PortletMode mode) throws PortletModeException
   {
      if (response_ instanceof StateAwareResponse)
      {
         StateAwareResponse res = (StateAwareResponse)response_;
         res.setPortletMode(mode);
      }
      else
      {
         throw new PortletModeException(
            "The portlet don't support to set a portlet mode by current runtime environment", mode);
View Full Code Here

        return request_.getPortletMode();
    }

    public void setApplicationMode(PortletMode mode) throws PortletModeException {
        if (response_ instanceof StateAwareResponse) {
            StateAwareResponse res = (StateAwareResponse) response_;
            res.setPortletMode(mode);
        } else {
            throw new PortletModeException("The portlet don't support to set a portlet mode by current runtime environment",
                    mode);
        }
    }
View Full Code Here

            // occurred which means that the request attributes should not be preserved.
            getBridgeRequestScope().setRedirectOccurred(true);

            // Apply the PortletMode, WindowState, etc. that may be present in the URL to the response.
            try {
              StateAwareResponse stateAwareResponse = (StateAwareResponse) portletResponse;
              bridgeRedirectURL.applyToResponse(stateAwareResponse);
            }
            catch (PortletModeException e) {
              logger.error(e.getMessage());
            }
View Full Code Here

TOP

Related Classes of javax.portlet.StateAwareResponse

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.