5 Replies Latest reply on Jan 10, 2013 8:54 AM by Ken Finnigan

    Ajax Based IPC in GateIn 3.5 Final

    ramchow Newbie

      We have built our portal application using Gate 3.5 Final version with JSF 2.0.

       

      We have 2 issues in our implementation

       

      1. We have 3 portlets which does IPC between them. Now the problem is when I click on any ojbect in Portlet A it refreshes the entire portal instead of refreshing the Portlet B and Portlet C.
      2. I am trying to call a Faces.xhtml file using PortletRequestDispatcher in doView method of GenericFacesPortlet but it does not recognizes the JSF tag that we have used in the Faces.xhtml. We have also a custom JSF component which we are using in our Faces.xhtml.

       

      We need immediate help on this so that we are ready for our deployment.

       

      regards

      Ramesh

        • 1. Re: Ajax Based IPC in GateIn 3.5 Final
          Ken Finnigan Master

          I'm not sure about 1, but I believe that is expected when all portlets on a page are re-rendered.

           

          For 2, are you using a Portlet Bridge? You shouldn't need to be doing anything with GenericFacesPortlet directly.

           

          For these kind of situations it's a good idea to have support, so that these kinds of questions can be answered promptly.

          • 2. Re: Ajax Based IPC in GateIn 3.5 Final
            ramchow Newbie

            Thanks Ken for your prompt response.

             

            In case one we have overall 5 portlets including header and footer with a left navigation, top menu and body. In our case all of these 5 portlets get refreshed when it should not.

            Secondly when I click anything on left navigation, the top menu must get refreshed and the body, similarly when I click on top menu the body must only get refreshed which is not happening.

             

            Whatever we do, the entire page gets refreshed which in turn calls business services reducing the performance.

             

            In 2nd case, we are using Portlet Bridge but I need to consume business services which I need to invoke from extended GenericFacesPortlet and then pass the object to our custom JSF component for rendering. Quick help on this would be really helpful to rollout our system and give an example to JBoss community about usage of new GateIn Portal 3.5

             

             

            Note: We would like to buy dedicated support from JBoss but not able to get from where we can register ourselves for the same.

             

            regards

            Ramesh

            • 3. Re: Ajax Based IPC in GateIn 3.5 Final
              Ken Finnigan Master

              For what reason do you believe the portlets on the page should not be refreshed?

               

              The standard behavior for a portal page is to refresh all the portlets on it when a portlet action or event was processed in one portlet.  A good practice for portlets is for their Render calls to use as few business service calls as possible as there is no restriction on how many times that Render can be called on a given portlet without any of it's content changing.

               

              I don't believe that extending GenericFacesPortlet is the right way to do what you need.  There should be no reason why the business service can't be called from your JSF code directly.

               

              I'm confused by your statement about not being able to register for support.  Is your company having problems trying to get a support agreement?

              • 4. Re: Ajax Based IPC in GateIn 3.5 Final
                ramchow Newbie

                Hi Ken

                 

                Thanks for your response again. As mentioned in my previous thread, we have 3 portlets which are inter-dependent.

                I want to submit/refresh Portlet B and Portlet C when I click an icon on Portlet A as Portlet B is dependent on Porlet A and Portlet C is dependent on Portlet B.

                 

                I would like to do a partial refresh of the entire portal. Currently we consume webservice on processAction and set render-parameter to be used by the dependent portlet.

                We have also extended GenericFacesPortlet to have our own implementation to consume webservice which are deployed on other servers.

                 

                When we try to redirect to a *.xhtml file from doView method of extended GenericFacesPortlet, it does not recognize the Faces tags.

                Is there any limitation of dispatching a request to .xhtml from doView method compared to .jsp file?

                 

                Below is the code snippet of portlet.xml

                 

                <portlet>

                     <portlet-name>ApplicationObjectsPortlet</portlet-name>

                     <portlet-class>com.casper.portlets.ApplicationObjectsPortlet</portlet-class>

                     <init-param>

                          <name>javax.portlet.faces.defaultViewId.view</name>

                          <value>/jsf/WorkxmateObject.xhtml</value>

                     </init-param>

                     <init-param>

                          <name>javax.portlet.faces.defaultViewId.edit</name>

                          <value>/jsf/WorkxmateObject.xhtml</value>

                     </init-param>

                     <init-param>

                          <name>javax.portlet.faces.defaultViewId.help</name>

                          <value>/jsf/WorkxmateObject.xhtml</value>

                     </init-param>

                     <init-param>

                          <name>javax.portlet.faces.preserveActionParams</name>

                          <value>false</value>

                     </init-param>

                     <expiration-cache>0</expiration-cache>

                     <supports>

                         <mime-type>text/xhtml</mime-type>

                         <portlet-mode>VIEW</portlet-mode>

                         <portlet-mode>EDIT</portlet-mode>

                         <portlet-mode>HELP</portlet-mode>

                     </supports>

                     <portlet-info>

                         <title>workXmate Objects</title>

                     </portlet-info>

                     <supported-public-render-parameter>appId</supported-public-render-parameter>

                     <supported-public-render-parameter>objId</supported-public-render-parameter>

                     <supported-public-render-parameter>objName</supported-public-render-parameter>

                     <supported-public-render-parameter>isDeployable</supported-public-render-parameter>

                     <supported-public-render-parameter>defaultObjId</supported-public-render-parameter>

                     <supported-public-render-parameter>buttonAction</supported-public-render-parameter>

                </portlet>

                 

                 

                doView method of ApplicationObjectsPortlet

                 

                public class ApplicationObjectsPortlet extends GenericFacesPortlet

                {

                 

                @Override

                public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException

                {

                     try

                     {

                          String appId = null;

                          PortletSession session = request.getPortletSession(true);

                          appId = request.getParameter("appId");

                          if(appId==null)

                          {

                               appId=(String) session.getAttribute("defAppId",PortletSession.APPLICATION_SCOPE);

                          }

                          SessionVO sessionVO= (SessionVO)session.getAttribute("sessionvo",PortletSession.APPLICATION_SCOPE);

                          ACLMgmtVO mgmtVo = new ACLMgmtVO();

                          mgmtVo.setOrgId(sessionVO.getOrgId());

                          mgmtVo.setUserId(sessionVO.getUserId());

                          mgmtVo.setAppId(appId);

                 

                          IEsbMgmtService service=Client.getClient(IEsbMgmtService.class, PropertyUtil.getObjUrl());

                          ACLMgmtVO mgmtResultVO = (ACLMgmtVO)service.getData(mgmtVo);

                          request.setAttribute("objects", mgmtResultVO);

                          getPortletContext().getRequestDispatcher("/jsf/WorkxmateObject.xhtml").include(request, response);

                     }

                     catch(Exception e)

                     {

                          e.printStackTrace();

                     }

                }

                }

                 

                What is it that we are doing wrong? Your quick help would be highly appreciated.

                 

                regards

                Ramesh

                • 5. Re: Ajax Based IPC in GateIn 3.5 Final
                  Ken Finnigan Master

                  In terms of partial refresh of just those 3 portlets, that isn't possible to my knowledge, unless there are only those 3 portlets on the page, which effectively means a full page refresh.  If processAction is called on a portlet, or any other invocation that results in the portlet lifecycle being executed, then all portlets on that page will have their Render methods called.  That's how the spec is currently defined.  One way to prevent a full refresh is by using Ajax calls in serveResource(), but then there is no way to cause a refresh of affected portlets.

                   

                  It's not possible to perform a request dispatch to anything other than a servlet or JSP page.  The reason it's not working is because xhtml files are neither of those.

                   

                  To use JSF in a portlet, you need to use the Portlet Bridge as designed and not modify GenericFacesPortlet