Announcement Announcement Module
Collapse
No announcement yet.
Share request attributes between version 1.0 portlets in the same context? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Share request attributes between version 1.0 portlets in the same context?

    Hi,

    I have written a 1.0 version portlet that is to be placed in multiple instances on the same page. And I am now trying to share an object between these instances, but I only want to share it for the duration of the request.

    First I tried storing it as a regular request attribute, but my tests showed that the request attribute I stored on the PortletRequest only had its own portlet instance as its scope.

    I know that I can share objects using the PortletSession/PortletContext, but I never want to see an old object (ie from a previous request*, even if it is only a few milliseconds old), and I have no good way to tell if a an object was stored for this request or for a old request.

    Is there a way to achieve this in a portlet 1.0 standard way?

    * With request here I mean a "page view" request, basically just as a http servlet request. So I want to be able to tell if the stored object was stored during this "page view" or a previous "page view".

    Regards
    /Jimi

  • #2
    To do that you'll need something like events in JSR286 but sadly there is no standard way to do that in JSR168.

    Comment


    • #3
      Originally posted by modlost View Post
      To do that you'll need something like events in JSR286 but sadly there is no standard way to do that in JSR168.
      Sadly, indeed.
      But I solved it by using a servlet filter, and there creating a HashMap<String, Object> and storing it as a request attribute (since the portlet framework I'm using makes all http request attributes available as portlet request attributes, I'm not sure if this is guaranteed in the JSR168 standard). That way the map is available for all portlets on the page, and they can thus share data for the duration of the request.

      /Jimi

      Comment

      Working...
      X