Package javax.portlet

Examples of javax.portlet.StateAwareResponse


      // If the specified bridge context is valid, then proceed with processing incoming public render parameters
      // since this phase listener is being executed within the portlet lifecycle.
      if (bridgeContext != null) {

        StateAwareResponse stateAwareResponse = (StateAwareResponse) bridgeContext.getPortletResponse();

        // Section 5.3.3 requires the phase listener to re-examine the public render parameters. For each one
        // that has been changed in the model, its new value must be set in the response, so that when the
        // RENDER_PHASE of the Portlet 2.0 lifecycle executes, this phase listener will be able to inject the
        // new value into the model of other portlets that are participating in the IPC.
        BridgeConfig bridgeConfig = bridgeContext.getBridgeConfig();
        Map<String, String[]> publicParameterMappings = bridgeConfig.getPublicParameterMappings();

        if (publicParameterMappings != null) {

          String portletName = bridgeContext.getPortletConfig().getPortletName();
          Map<String, String[]> publicParameterMap = bridgeContext.getPortletRequest()
            .getPublicParameterMap();
          Set<String> publicRenderParameterNames = publicParameterMappings.keySet();

          // For each of the public render parameters found in the WEB-INF/faces-config.xml file:
          for (String prefixedParameterName : publicRenderParameterNames) {
            String[] modelExpressions = publicParameterMappings.get(prefixedParameterName);

            if (modelExpressions != null) {

              String parameterPrefix;
              String nonPrefixedParameterName;

              int colonPos = prefixedParameterName.indexOf(StringPool.COLON);

              if (colonPos > 0) {
                parameterPrefix = prefixedParameterName.substring(0, colonPos);
                nonPrefixedParameterName = prefixedParameterName.substring(colonPos + 1);
              }
              else {
                parameterPrefix = null;
                nonPrefixedParameterName = prefixedParameterName;
              }

              for (String originalModelEL : modelExpressions) {

                String[] parameterValues = publicParameterMap.get(nonPrefixedParameterName);
                String parameterValue = null;

                if ((parameterValues != null) && (parameterValues.length > 0)) {
                  parameterValue = parameterValues[0];
                }

                PublicRenderParameter publicRenderParameter = new PublicRenderParameterImpl(
                    parameterPrefix, parameterValue, originalModelEL, portletName);

                if (publicRenderParameter.isForThisPortlet()) {

                  String modelValue = publicRenderParameter.getModelValue(facesContext);
                  boolean modelValueHasChanged = publicRenderParameter.isModelValueChanged(
                      facesContext);

                  if (logger.isTraceEnabled()) {
                    logger.trace(
                      "portletName=[{0}] public render parameter=[{1}] parameterValue=[{2}] modelValue=[{3}] modelValueHasChanged=[{4}]",
                      portletName, nonPrefixedParameterName, parameterValue, modelValue,
                      modelValueHasChanged);
                  }

                  if (modelValueHasChanged) {
                    logger.debug(
                      "Setting render parameter=[{0}] in response because modelValue=[{1}] has changed",
                      nonPrefixedParameterName, modelValue);
                    stateAwareResponse.setRenderParameter(nonPrefixedParameterName, modelValue);
                  }
                  else {
                    logger.debug(
                      "NOT setting render parameter=[{0}] in response because modelValue=[{1}] has NOT changed",
                      nonPrefixedParameterName, modelValue);
View Full Code Here


            if (portletResponse instanceof StateAwareResponse) {
              logger.debug("Setting former session-attribute as render parameter name=[{0}] value=[{1}]",
                bridgeRequestScopeKey, bridgeRequestScopeId);

              StateAwareResponse stateAwareResponse = (StateAwareResponse) portletResponse;
              stateAwareResponse.setRenderParameter(bridgeRequestScopeKey, bridgeRequestScopeId);
            }
          }
          else {
            logger.error(
              "Found session attribute name=[{0}] value=[{1}] but bridgeRequestScope is not in the cache",
View Full Code Here

      if (portletResponse instanceof StateAwareResponse) {
        logger.debug("Setting render parameter name=[{0}] value=[{1}]", bridgeRequestScopeKey,
          bridgeRequestScopeId);

        try {
          StateAwareResponse stateAwareResponse = (StateAwareResponse) portletResponse;
          stateAwareResponse.setRenderParameter(bridgeRequestScopeKey, bridgeRequestScopeId);
        }
        catch (IllegalStateException e) {

          // If a redirect occurred, then swallow/ignore the IllegalStateException
          if (bridgeRequestScope.isRedirectOccurred()) {
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.