Package org.jboss.portletbridge.context

Examples of org.jboss.portletbridge.context.PortletBridgeContext


      {
         log.fine("Start bridge event request processing for portlet "
            + getPortletName());
      }
      //init bridge context and set PORTLET_LIFECYCLE_PHASE to current portlet phase
      PortletBridgeContext bridgeContext = initRequest(request,
                                                       response,
                                                       Bridge.PortletPhase.EVENT_PHASE);

      //get RequestScopeManager which holds STATE_ID parameter and adds
      // REQUEST_STATE_MANAGER to PortletSession
      RequestScopeManager requestStateManager =
         RequestScopeManager.getInstance(request, numberOfRequestScopes);

      //get the stateId for this event request, simple init with stateId and randomUUID
      StateId stateId = requestStateManager.getStateId(request, response);

      //store in bridge context
      bridgeContext.setStateId(stateId);

      //get the current RequestScope from the stateId otherwise get it form states map
      BridgeRequestScope windowState = requestStateManager.getRequestScope(stateId);

      //check for failure of pulling it from the RequestScopeManager's map of "states"
      if (null == windowState)
      {
         windowState = new BridgeRequestScope();
      }
      else
      {
         windowState.reset();
      }
      //create the facesContext using facesContextFactory
      FacesContext facesContext = createFacesContext(request, response);

      try
      {
         // If strategy enlists Seam, Propagate current render parameters.
         //call FacesLifecycle.beginRequest from seamPhaseListenerWrapper
         //  which will setup up all the contexts, except conversation is null
         strategy.beforeEventRequest(facesContext);

         //portlet sets render params
         response.setRenderParameters(request);

         //helper method for setting incoming params as EL variables
         processIncomingParameters(facesContext, request);

         //execute phases from LifecyclePhase - for actions only
         execute(facesContext);

         //check for null event handler
         if (null == eventHandler)
         {
            log.severe("The EventHandler is null for " + getPortletName() + ". Ensure " +
               "your portlet.xml settings are correct and that you have implemented the " +
               "BridgeEventHandler in your application.");
         }
         //get the event from the request
         Event event = request.getEvent();

         //Handle the event and get the result
         EventNavigationResult result = eventHandler.handleEvent(facesContext, event);

         if (result != null)
         {
            facesContext.getApplication().getNavigationHandler().handleNavigation(facesContext,
                                                                                  result.getFromAction(),
                                                                                  result.getOutcome());
            // the navigation rule might indicate a redirect
            if (facesContext.getResponseComplete())
            {
               return;
            }
         }

         //now place view root in request scope.
         windowState.setViewRoot(facesContext.getViewRoot());

         //set the request scope of this event (aka windowState)
         bridgeContext.setRequestScope(windowState);
        
         //helper for removal and addition of PRPs
         processOutgoingParameters(facesContext, request, response);

         //update stateId in RequestScopeManager and put it on session as REQUEST_STATE_MANAGER
View Full Code Here


   private Map getPreferencesValuesMap(FacesContext context) {
    if (isPortletRequest()) {
      return ((PortletRequest) context.getExternalContext().getRequest())
          .getPreferences().getMap();
    } else {
      PortletBridgeContext bridgeContext = (PortletBridgeContext) context
          .getExternalContext().getRequestMap().get(
              PortletBridgeContext.REQUEST_PARAMETER_NAME);
      Map portletPreferencesMap = Collections.emptyMap();
      if (null != bridgeContext) {
        PortletWindowState windowState = bridgeContext.getWindowState();
        portletPreferencesMap = windowState
            .getPortletPreferencesMap();
      }
      return portletPreferencesMap;
    }
View Full Code Here

        super.writeState(context, state);
        stateResponseWriter.flush();
        String stateString = buff.toString();
        originalWriter.write(stateString);
        String stateValue = getStateValue(stateString);
          PortletBridgeContext bridgeContext = (PortletBridgeContext) context.getExternalContext().getRequestMap().get(PortletBridgeContext.REQUEST_PARAMETER_NAME);
          if(null != bridgeContext){
            Map<String, String[]> requestParameters = bridgeContext.getWindowState().getRequestParameters();
            if(null != stateValue){
            requestParameters.put(ResponseStateManager.VIEW_STATE_PARAM, new String[]{stateValue});
          } else {
            requestParameters.remove(ResponseStateManager.VIEW_STATE_PARAM);
          }
View Full Code Here

    FacesContext context = event.getFacesContext();
    Object portletPhase = context.getExternalContext().getRequestMap().get(
        Bridge.PORTLET_LIFECYCLE_PHASE);

    PortletWindowState windowState = null;
    PortletBridgeContext bridgeContext = (PortletBridgeContext) context
        .getExternalContext().getRequestMap().get(
            PortletBridgeContext.REQUEST_PARAMETER_NAME);
    if (null != bridgeContext) {
      windowState = bridgeContext.getWindowState();
    }

    if (phaseId.equals(PhaseId.RESTORE_VIEW)) {
      if (Bridge.PortletPhase.RenderPhase.equals(portletPhase)) {
        context.renderResponse();
View Full Code Here

    if (null == portletPhase && phaseId.equals(PhaseId.RENDER_RESPONSE)) {
      // For a servlet phase, put all portletbridge-related parameters
      // back to ajaxContext.

      PortletWindowState windowState = null;
      PortletBridgeContext bridgeContext = (PortletBridgeContext) context
          .getExternalContext().getRequestMap().get(
              PortletBridgeContext.REQUEST_PARAMETER_NAME);
      if (null != bridgeContext) {
        windowState = bridgeContext.getWindowState();
      }

      if (null != ajaxContext && null != windowState) {
        Map commonAjaxParameters = ajaxContext.getCurrentInstance(
            context).getCommonAjaxParameters();

        PortalActionURL pal = windowState.getPortalActionURL();
        if (null != pal) {
          pal.setParameter(AbstractExternalContext.VIEW_ID_PARAMETER,
              context.getViewRoot().getViewId());
        }
        commonAjaxParameters.put(PortletStateHolder.STATE_ID_PARAMETER,
            bridgeContext.getStateId().toString());
        commonAjaxParameters.put(
            AjaxPortletBridge.AJAX_NAMESPACE_PARAMETER, windowState
                .getNamespace());

      }
View Full Code Here

    */
   public void saveBeans(FacesContext facesContext) {
      beans = null;
      ExternalContext externalContext = facesContext.getExternalContext();
      Map<String, Object> requestMap = externalContext.getRequestMap();
      PortletBridgeContext bridgeContext = (PortletBridgeContext) requestMap
              .get(PortletBridgeContext.REQUEST_PARAMETER_NAME);
      Set<String> existingAttributes = null;
      if (null != bridgeContext) {
         existingAttributes = bridgeContext
                 .getInitialRequestAttributeNames();
      }
      if (null == existingAttributes) {
         existingAttributes = new HashSet<String>();
      } else {
View Full Code Here

           Map<String, Object> portletPreferencesMap) {
      this.portletPreferencesMap = portletPreferencesMap;
   }

   public PortletBridgeContext createBridgeContext() {
      return new PortletBridgeContext() {

         @Override
         public PortletWindowState getWindowState() {
            return PortletWindowState.this;
         }
View Full Code Here

                  || facesContext.getRenderResponse() || facesContext
                  .getResponseComplete())) {
//         Manager manager = Manager.instance();
//         manager.beforeRedirect();
         // save Seam conversation Id.
      PortletBridgeContext bridgeContext = (PortletBridgeContext) facesContext
          .getExternalContext().getRequestMap().get(
              PortletBridgeContext.REQUEST_PARAMETER_NAME);
      if (null != bridgeContext) {
        PortletWindowState windowState = bridgeContext.getWindowState();
        windowState.saveSeamConversationId(facesContext);
      }
         _defaultListener.afterResponseComplete(facesContext);
      }
View Full Code Here

TOP

Related Classes of org.jboss.portletbridge.context.PortletBridgeContext

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.