3 Replies Latest reply on Jul 25, 2011 7:24 AM by infoni

    Portlet preferences within serveResource method

    infoni

      Hi,

       

      I'm trying to set the portlet preferences through an AJAX call. I've opted to use the serveResource() method of the portlet. When I invoke the portlet function, serveResource(), through the AJAX call, the method does get executed. Within the serveResource() method, I then proceed to update my portlet preference:

       

      String mypreference= request.getParameter("mypreference");

      PortletPreferences portletPreference = request.getPreferences();
      portletPreference.setValue("mypreference", mypreference);
      portletPreference.store();

       

      It doesnt throw an exception, but it doesnt work neither: mypreference is correctly updated in resourceRequest, but not stored permanently. Specifications 286 seems authorize update preferences in serveResource method (PLT.13.1):

       

      For serveResource calls only state changes to non-shared state, like the portlet session scope or portlet preferences, should be performed

       

      , and it works in liferay. 

       

      Do someone has informations about this issue?

      Thx

        • 1. Re: Portlet preferences within serveResource method
          infoni

          I use Gatein 3.2 bundle with tomcat 6.0

          • 2. Re: Portlet preferences within serveResource method
            hoang_to

            Could you clearify 'not stored permanently'? A ResourceServing portlet is typically triggered after RenderRequests, so modifying PortletPreference within a ResourceServing portlet has no effect on returned portlet markup

            • 3. Re: Portlet preferences within serveResource method
              infoni

              Hi Minh,

               

              thanks for response i was on holidays last week. I mean 'not stored permanently', portlet preferences are not stored in portal database. It seems

              portletPreference.store()

              has none effect in a serveResource method, i cant figure why.

               

              I try to keep a full compatibility for my application with Websphere portal, Gatein and Liferay, and i'm stuck on that issue with Gatein :/ I love this portal i absolutly want to find a workaround or at least an explanation.

               

               

              Any idea / suggestion would be much appreciated